Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

g++ not working on Windows command prompt. Cygwin installed

I have installed Eclipse and CDT (to use C/C++ in eclipse CDT is needed), as well as installing Cygwin so that I can compile my files.

In environment variables I've set Path to include the following: "C:\cygwin\bin;"

g++, make and GDC are all installed via Cygwin. I made sure of this by searching for them in the bin folder - they're all there.

If I enter "make" into the windows command prompt, this appears:

make: *** No targets specified and no makefile found.  Stop.

If I enter "g++" or "gdc" into the windows command prompt, this appears (or similar):

'g++' is not recognized as an internal or external command,
operable program or batch file.

So, in other words make is working but the rest isn't..but they're in the same bin folder! Has got me completely confused.

If I attempt to open Cygwin Bash Shell, g++, make and GDC all work there.

However, I need it to work in the command prompt so that Eclipse is able to compile the programs I write in the IDE.

If you know why this is happening, please let me know.

like image 487
LeigerGaming Avatar asked Mar 12 '09 10:03

LeigerGaming


2 Answers

I haven't used cygwin much, but my understanding is you have to use it from the cygwin bash shell.

if you need g++, make, etc, use mingw, with it, g++ works from the normal windows command line.

like image 180
hasen Avatar answered Oct 25 '22 20:10

hasen


Here is what happened to me and how I fixed it. My C:\cygwin\bin\g++.exe is a shortcut pointing to C:\etc\alternatives\g++.exe, which points back to C:\cygwin\bin\g++-3.exe. Replacing g++ with g++-3 worked for me.

like image 42
ylu Avatar answered Oct 25 '22 22:10

ylu