MinGW/Eclipse ld.exe does not find libraries

TheSHEEEP picture TheSHEEEP · Feb 3, 2012 · Viewed 48.8k times · Source

I am using Eclipse CDT to try to compile a project with the Ogre 3D engine. But somehow mingw is not able to find the static libraries I link against.

These are the error messages:

c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lzziplib_d

c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lzlib_d

c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lfreetype_d

...etc. The list goes on like this for each library.

As you can probably see, I already am aware of the (IMO) weird "lib" and ".a" additions the ld.exe seems to make automatically. The libraries are all named correctly. So for example, the "freetype_d" really is "libfreetype_d.a".

I have also added the correct paths to the libraries before, like this:

-L"C:\Coding\Ogre\make-debug\sdk\lib\Debug\" -L"C:\Coding\Ogre\make-debug\sdk\lib\Debug\opt\"

And each library file is in one of these two folders.

This is my full command line as displayed by Eclipse CDT:

g++ -L"C:\Coding\Ogre\make-debug\sdk\lib\Debug\" -L"C:\Coding\Ogre\make-debug\sdk\lib\Debug\opt\" -o "OgreTestMinGW" ./BaseApplication.o ./LowLevelOgre.o -lzziplib_d -lzlib_d -lfreetype_d -lFreeImage_d -lOIS_d.dll -lOgreMainStatic_d -lOgrePagingStatic_d -lOgrePropertyStatic_d -lOgreRTShaderSystemStatic_d -lOgreTerrainStatic_d -lRenderSystem_GLStatic_d -lPlugin_ParticleFXStatic_d -lPlugin_PCZSceneManagerStatic_d -lPlugin_OctreeZoneStatic_d -lPlugin_OctreeSceneManagerStatic_d -lPlugin_CgProgramManagerStatic_d -lPlugin_BSPSceneManagerStatic_d

What am I missing here?

Answer

Janek Olszak picture Janek Olszak · Jul 4, 2012

On Windows, when you add libraries path "-L" and click "File System" Eclipse gives you the path with "\", change those to "/" and it shall work!