How to setup the MinGW gcc tools for your Managed Make C Project in CDT 3.1 and Eclipse 3.2



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/01/how-to-setup-mingw-gcc-tools-for-your/

You should be redirected in 2 seconds.



Here is a good article about how to setup MinGW tools with CDT and Eclipse. However I got one error when I setup my project. I got a
"/usr/bin/sh: c:mingwbinmingw32-gcc: command not found"
error. This was because I had "c:\cygwin\bin" in my path. To remedy this, you can set the "PATH" environment variable for your project. This will allow you to search the "c:\mingw\bin" path instead of the "c:\cygwin\bin" path without changing your path outside of Eclipse. This is also the solution if you have the wrong "include" directories listed in your "Includes" folder. E.g., if you have cygwin directories in your "Includes" folder, probably the cygwin gcc command is being used. See also my other post, How to set the include paths for gcc in a Managed Make project in Eclipse 3.2.1 and CDT 3.1

Update 2/5/2007:
You will also likely get a warning which says: Error launching 'cygpath' command'
See my post, Eclipse/CDT bug: Error launching 'cygpath' command about that.
To setup a GDB debugger, see my post, How to use the mingw gdb debugger with Eclipse 3.2 / CDT 3.1
Also, here is another good tutorial about setting up CDT: http://max.berger.name/howto/cdt/

Here are the detailed steps:
  1. Right-click on your project and select "Properties"
  2. Select "C/C++ Build" from the sidebar
  3. Click the "Tool Settings" tab
  4. Click the "GCC C Compiler" and enter "mingw32-gcc" in the "Command:" field
  5. Click the "GCC C Linker" and enter "mingw32-gcc" in the "Command:" field
  6. Click the "Build Settings" tab
  7. Uncheck the "Use default command" checkbox
  8. Replace "make" with "mingw32-make -k"
  9. Click the "Environment" tab; click the "Configuration" tab
  10. Click the "New" button
  11. From the "Name" dropdown box, select "Path"
  12. In the "Value" field, delete the contents and enter "C:\mingw\bin"
  13. In the "Delimiter" field, leave it as ";"
  14. In the "Operation" field, select "Replace"
  15. Click "OK"; click "OK"

3 comments:

Anonymous said...

thanks! u save my life!!!!!im new in eclipse. i need one with C++ plugin to deal with my project. i do the whole day just to get the hello world compiled. phew~

Anonymous said...

In my case cygwin wasn't in my path and I still got "/usr/bin/sh: c:mingwbinmingw32-gcc: command not found"
The only solution I found was to remove cygwin from my machine altogether.

Anonymous said...

I downloaded eclipse 3.3.0 and CDT 4.0 for windows XP (the last versions). The project dialog box is sadely different.
Moreover, it wants to create a directory named
[java.lang.String;@1087070
this last number not always the same. But this directory name is not valid under windows. So, during compile or link time, several "Include path not found" are generated.

About

This is my *OLD* blog. I've copied all of my posts and comments over to my NEW blog at:

http://www.saltycrane.com/blog/.

Please go there for my updated posts. I will leave this blog up for a short time, but eventually plan to delete it. Thanks for reading.