views:

2967

answers:

7

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.

+2  A: 

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.

hasen j
Mingw is what I am using with Eclipse, works great.
cmsjr
I will try installing mingw and let you know the result.
Shane
Yes, thanks :) Installing mingw solved the problem once I added MingW's bin folder to Path as well. Thanks!
Shane
A: 

You could install a Windows version of which to get some help in figuring out exactly which executables are being run.

Perhaps it's picking up 'make' from somewhere completely different, and your addition to %PATH% is not working.

Also verify it by typing echo %path% in the same command prompt window as you're seeing the problem in, just to make sure.

unwind
unwind,I tried echo %PATH% and this appeared:C:\cygwin\bin;C:\Program Files\Java\jdk1.6.0_12\bin;C:\Windows\system32; (... plus the rest of the usual paths ...)
Shane
I have installed which. Typing in "which make" results in '/usr/bin/make', and typing in "which g++" results in '/usr/bin/g++' (same path), but make is still working and g++ is not ???
Shane
A: 

Did you change the path after you opened the cygwin shell? If so, it won't pick up the change in the environment. Try restarting the cygwin shell and see if the problem persists.

ConcernedOfTunbridgeWells
A: 

In the CMD window, try typing bash to start a bash shell in that window. If that doesn't work, then the cygwin bin directory is not on your path.

If it did work, enter type g++ and type make to see the paths that are being used for these commands. I'm pretty sure your problem is with your PATH variable.

anon
When I entered bash into the command prompt, this appeared: --- "bash-3.2$" --- g++ and make DO work from this prompt.
Shane
A: 

As was suggested at first, I installed MingW and added the program's bin file to %PATH%

That solved the problem.

I still don't know why it wasn't working earlier, as it was definitely finding g++ in the right directory (proven when I used 'which' for Windows)

Thanks for the help guys.

Shane
A: 

I'm suffering the same problem.

But when I enter type make, or type c++. It sais that the system can't find the given file.

Grz. Rikketik

+1  A: 

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.

ylu
I found the same shortcut on my installation and used the same solution.
Tim Henigan