|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
Registered: October 2011
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.|
- Install MinGW.
- 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.
- Run Eclipse, then in Window | Preferences | C/C++ | XL C/C++ Compiler, set 'Compiler Root Path' to the bin directory of your MinGW installation.
- 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.
- Select MinGW as the toolchain to use for your new project, type in the project name, click Finish and then it will be created.
- 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.
- Under Project Properties | C/C++ General | Paths and Symbols | Library Paths, add the path of the MinGW lib directory (e.g. C:\MinGW\lib).
- 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!
[Updated on: Thu, 13 October 2011 21:15]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02363 seconds