Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How do I link MinGW C/C++ compiler to Eclipse
How do I link MinGW C/C++ compiler to Eclipse [message #735807] Wed, 12 October 2011 19:03 Go to next message
Roey  is currently offline Roey Friend
Messages: 16
Registered: April 2010
Junior Member
Hi,

I have Eclipse Version: Helios Service Release 2 Build id: 20110301-1815
with CDT under windows 7 x64 OS.

The IDE doesn't recognize any C/C++ libraries and a compiler , I've installed MinGW in my system how do I make Eclipse recognize it ?

THNX ALOT
Re: How do I link MinGW C/C++ compiler to Eclipse [message #735851 is a reply to message #735807] Wed, 12 October 2011 21:31 Go to previous messageGo to next message
victor.e  is currently offline victor.e Friend
Messages: 8
Registered: October 2011
Location: Australia
Junior Member
What worked for me was adding MinGW's bin directory to the PATH variable then restarting Eclipse. I then added this bin directory path to C/C++ | XL C/C++ Compiler under Window | Preferences.
Re: How do I link MinGW C/C++ compiler to Eclipse [message #735915 is a reply to message #735851] Thu, 13 October 2011 05:38 Go to previous messageGo to next message
Roey  is currently offline Roey Friend
Messages: 16
Registered: April 2010
Junior Member
victor.e wrote on Wed, 12 October 2011 17:31
What worked for me was adding MinGW's bin directory to the PATH variable then restarting Eclipse. I then added this bin directory path to C/C++ | XL C/C++ Compiler under Window | Preferences.


Hi Victor,

Under window>preferences>c/c++>build>environment I have a variable called PATH which his value is ...\MinGW\bin. still it is not compiling or linking the standard .h libraries.

Could you be more exact ? could you please give me exact guidance ?

THNX

[Updated on: Thu, 13 October 2011 05:48]

Report message to a moderator

Re: How do I link MinGW C/C++ compiler to Eclipse [message #736225 is a reply to message #735915] Thu, 13 October 2011 20:46 Go to previous messageGo to next message
victor.e  is currently offline victor.e Friend
Messages: 8
Registered: October 2011
Location: Australia
Junior Member
OK, what I did is listed below. Please note that I'm also new to Eclipse, having installed it for the first time 2 weeks ago, so I'm no expert (although I have used software IDEs before). The approach I use may not be the best one, but it works for me.

  1. Install MinGW.
  2. Ensure Eclipse is NOT currently running, then insert the MinGW bin directory path (e.g. C:\MinGW\bin) at the start of your Windows PATH environment variable. I have XP, so I don't know how this is done in Windows 7. NOTE: I haven't specified a PATH variable under Window | Preferences | C/C++ | Build | Environment; I don't believe this is necessary in order for Eclipse to recognise MinGW as an available toolchain.
  3. Run Eclipse, then in Window | Preferences | C/C++ | XL C/C++ Compiler, set 'Compiler Root Path' to the bin directory of your MinGW installation.
  4. Create a new project using File | New | C++ Project (or C Project, etc.), then select one of the project type options. MinGW should be listed as one of the available toolchains for various project types.
  5. Select MinGW as the toolchain to use for your new project, type in the project name, click Finish and then it will be created.
  6. Under Project Properties | C/C++ General | Paths and Symbols, the 'Includes' tab should automatically be populated with the MinGW include directories, giving you access to all the standard C/C++ include files.
  7. Under Project Properties | C/C++ General | Paths and Symbols | Library Paths, add the path of the MinGW lib directory (e.g. C:\MinGW\lib).
  8. When linking occurs during a build, the standard MinGW libraries should be linked automatically. If you need to specify additional ones, put them in Project Properties | C/C++ General | Paths and Symbols | Libraries. An example: while developing a Qt application, I added QtCored4 and QtGuid4 to the list of libraries, as these contain the Qt graphics library functions I (currently) need. NOTE: You will need to specify different libraries for your Debug vs. Release configurations, e.g. the Qt libraries I mentioned contain the debug symbols, but for the Release configuration, I've specified QtCore4 and QtGui4 (note the absence of the 'd'). Interestingly enough, you can specify full pathnames and filenames in the library list, or just the library filename stubs that I mentioned above (and which appear in the console window in the linking command-line).

Regarding step 2 above: MinGW doesn't need to be installed to its default path (which I think is C:\MinGW). I've installed it to a USB memory stick, which also contains Eclipse, and on both my home and work PCs, I've mapped G: drive to this memory stick, so I can use Eclipse at both locations with no changes required.

I understand from other posts on this forum that it may also be possible to use Eclipse to refer to the MinGW installation path using a relative path name, in case the memory stick gets mapped to another drive letter, but I haven't tried this particular approach.

Hopefully I didn't miss any steps above, but try the above and see how you go. Good luck! Smile

[Updated on: Thu, 13 October 2011 21:15]

Report message to a moderator

Re: How do I link MinGW C/C++ compiler to Eclipse [message #737097 is a reply to message #736225] Fri, 14 October 2011 16:52 Go to previous messageGo to next message
Roey  is currently offline Roey Friend
Messages: 16
Registered: April 2010
Junior Member
Hi Victor,

The PATH variable in my OS is configured with MinGW.
I don't know why I have to install the XL c/c++ compiler ?
Where do I find the compiler directory without installing the XL ? that's my problem.

THNX ALOT for the detailed explanation.
Re: How do I link MinGW C/C++ compiler to Eclipse [message #1776108 is a reply to message #737097] Sat, 11 November 2017 13:48 Go to previous message
Mythri Thippareddy is currently offline Mythri ThippareddyFriend
Messages: 1
Registered: November 2017
Junior Member
Hi, Did you find the solution for this? I have the same problem. Whenever I create a project, MINGW does not show in the options of the compiler. After creating the project, I have to go to properties of the project and then link it to MinGW. Kindly let me know if you found a solution.

Thank you
-Mythri
Previous Topic:Error when using *.so
Next Topic:Updating eclipse c++ error
Goto Forum:
  


Current Time: Mon Dec 11 05:51:08 GMT 2017

Powered by FUDForum. Page generated in 0.01818 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software