I am new to C++ and made my first program which looks like this:
#include <iostream>
using namespace std;
int main()
{
cout << "Bonjour Monde!" << endl;
return 0;
}
I am using dev-c++. I was wondering how do I compile using Cygwin.
17 5783
Choose "Save as",select a proper folder where to save your file to.
Press <Ctrl> + F9 to compile your source.
Press <Ctrl> + F10 to execute your program.
otherwise ,in windows ,from command line,type
gcc.exe yourprogram.c -o yourprogram.exe
where do i press <ctrl>+F9
Using cygwin, type: - g++ yourProgramNameHere.cpp -o yourExeNameHere.exe
For a C program, - gcc yourProgramNameHere.c -o yourExeNameHere.exe
Make sure you're in the folder with your program file.
I am new to C++ and made my first program which looks like this:
#include <iostream>
using namespace std;
int main()
{
cout << "Bonjour Monde!" << endl;
return 0;
}
I am using dev-c++. I was wondering how do I compile using Cygwin.
What is the exe name. and the file is called hello.c
In gcc/g++ the -o option allows you to specify the name of the resulting executable file. So when you type in '-o myprog.exe' you are saying, "call the resulting executable of my program 'myprog.exe' " and that is the file you either just type in at the command line (depending on how everything is set up) or you type ./myprog.exe.
If you do not specify the -o option, it will be named a.exe (on Cygwin) or a.out (Linux).
In gcc/g++ the -o option allows you to specify the name of the resulting executable file. So when you type in '-o myprog.exe' you are saying, "call the resulting executable of my program 'myprog.exe' " and that is the file you either just type in at the command line (depending on how everything is set up) or you type ./myprog.exe.
If you do not specify the -o option, it will be named a.exe (on Cygwin) or a.out (Linux).
I have an error though. It says bash: gcc: command not found.
I have an error though. It says bash: gcc: command not found.
You have to install it via the setup program, I don't believe it is installed by default.
where do i install it.
You need to run the Cygwin setup program again and install. This is most likely wherever you installed it originally, but I make it a point to move it back to C:/Cygwin so I don't lose it. Run the setup.exe, and it keeps your currently installed packages (unless you de-select them from the list), and will install any new packages you choose.
I'd recommend searching your computer for the setup.exe file as it could be anywhere (most likely your desktop or 'My Documents' folder). It will have the Cygwin icon.
You have to install it via the setup program, I don't believe it is installed by default.
I think this happens because he doesn't provide the full path of the gcc command;please update the shell Path variable with the path of the directory where gcc is installed;this can be done through control panel->system->advanced->environment variables
otherwise,type the whole path of gcc.exe
for example if gcc is in C:\mytools you should type
C:\mytools\gcc.exe mysource.c -o mysource.exe
I think this happens because he doesn't provide the full path of the gcc command;please update the shell Path variable with the path of the directory where gcc is installed;this can be done through control panel->system->advanced->environment variables
otherwise,type the whole path of gcc.exe
for example if gcc is in C:\mytools you should type
C:\mytools\gcc.exe mysource.c -o mysource.exe
This is so if you are not using Cygwin to compile (and just Dev C++). If you are using gcc/g++ inside Cygwin, you do not need to do this.
(Well, at least I never have...)
cant i just use dev c++ to compile.
i just found something that says
There doesn't seem to be a GNU make file in PATH or in dev-c++'s Bin Path. Please make surethat you have GNU make and adjust bin setting or system PATH enviroment variable and that make setting in Compiler Option contains correct filename, otherwise you will not be able to compile anything.
Is that the problem? How do i fix it.
i just found something that says
There doesn't seem to be a GNU make file in PATH or in dev-c++'s Bin Path. Please make surethat you have GNU make and adjust bin setting or system PATH enviroment variable and that make setting in Compiler Option contains correct filename, otherwise you will not be able to compile anything.
Is that the problem? How do i fix it.
Yes, as I said, if you are using Dev C++, you must put the path in the environment variables (as specified above). However, if you can find the file through Cygwin, you don't need to do that. It's up to you.
how do i put the path in the enviroment variables?
how do i put the path in the enviroment variables?
We could tell you the answer to this question. But you're turning into a help vampire. Look, whether or not you realize this, you can't keep running back to us everytime you don't know something. Googling something takes about 5 seconds. Reading the material you get from Google takes a bit of work.
As a programmer, you need to be able to actively solve problems, Googling, reading material, reading books, etc. as needed. Get some practice now. If we say something, and you don't understand how to do what we ask, Google first, read the material, and try it.
See definition of help vampire. Also see article on asking smart questions.
That and the fact that this will be the second time I am telling you that it is posted above.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Brian |
last post by:
Greetings:
I am trying to compile the following code via command line.
It compiles just fine in visual studio 2002 v7 so i took looked at the
properties and i
got the following command line...
|
by: newbiecpp |
last post by:
I have hard time to understand run-time environment. Let assume that I have
a program that has a simple variable alpha. When this variable is
statically allocated, the compiler can use the...
|
by: Brice Prunier |
last post by:
Here under 4 schemas i'm working with ( it may be long: sorry...)
The context is the following :
Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous schema:
no TargetNamespace )...
|
by: Jean-David Beyer |
last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2
V6.1 (with all the FixPacks) on my old machine.
I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
|
by: Bart Goeman |
last post by:
Hi,
I have a question about how to put redundant information in data
structures, initialized at compile time. This is often necessary
for performance reasons and can't be done at run time (data...
|
by: |
last post by:
I am trying to compile a simple c# class in Web Matrix called howdy.cs:
// Program start class
public class HowdyPartner
{
// Main begins program execution
public static void Main()
{
//...
|
by: John Smith |
last post by:
Hi
I'm porting some C++ code to new platforms and have some 1-byte aligned
structures which need a specific size. Since datatypes can vary on different
platforms (which I found out the hard way...
|
by: 张沈鹏 |
last post by:
How to compile the HelloWorld of boost.asio?
Maybe this is a stupid problem , but I really don't konw how to find
the right way.
My compile environment is
WinXP,
Msys ,
MinGw ,
G++ 3.4.2,...
|
by: zaidalin79 |
last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to compile to at least get a few points... Here are the...
|
by: BruceWho |
last post by:
I downloaded boost1.35.0 and built it with following command:
bjam --toolset=msvc-7.1 --variant=release --threading=multi --
link=shared --with-system stage
and it failed to compile, error...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
| |