C++ eclipse mingw external library problem
I am trying to include an image library to eclipse... but just get following error message:
g++ -LC:\MinGW -LC:\librariesC\CImg149 -oCImgSd.exe CImgSd.o -lCImg
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lCImg
I already added the library search paths, where the 1. MinGw and 2. CImg files are, in Project properties - C/C++Build - Settings
First in GCC C++ Compiler - includes
second in GCC C Compiler - includes
third in MinGW C++ Linker - libraries
Furthermore I added the name of of the lib file 'CImg' to the second and third.
The file it should find is 'CImg.h' and it is placed in the C:\MinGW -LC:\librariesC\CImg149 folder.
I am using windows7 and added C:\MinGW\bin to the path variable
Or is it maybe a mingw problem, someone knows a better C++ Compiler, which I can use easily with an image processing library?
Someone knows what's wrong, because I'm googling for three days right now and tried many things but nothing worked out...
You do not need the file 'CImg.h' at that build step. Header files are only necessary for compiling the code, you're already linking your compiled code when this error occurs.
You need to specify the library file, i.e. something like CImg.lib most probably. I don't have a setup using Windows7/MinGW at the moment, but iirc you have to specify the library file including the extension, e.g. "CImg.lib" within the project configuration. Make sure the library path points to the directory including that file, not the .h file.
Thanks for the quick answer, but there's no .lib file in the cimg.zip i downloaded. Do I have do process the original files before I can use them as library?
Probably you have downloaded the library's source code only.
In general, you have several options (I don't know your specific library but that should do it in most cases):
* create a new Eclipse CDT project using the source code from the library and build a lib file, use that lib file for linking
* create the lib project and link the source folder as additional source folder to your project, i.e. your project includes the complete source code of the library then
* libs could contain build scripts, makefiles,... for building outside of an IDE
If you do not wish to change the source code contained in the library, I'd choose a way to compile the library to a .lib file and then use that lib file for linking. Otherwise, CDT is working fine if you just link (on file system level using Eclipse, not linking object files) the source folders into your project.