14

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?

TheSHEEEP
  • 2,961
  • 2
  • 31
  • 57
  • 3
    Hahahaha... The error was "\" in the directoy path. I replaced them with "/" and now it works. I fall for that one every single time ;) – TheSHEEEP Feb 03 '12 at 11:58

2 Answers2

17

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!

Janek Olszak
  • 4,067
  • 1
  • 28
  • 22
0

looks like you should try to remove "_d" from library names and add -DDEBUG . Also, debug libraries can be stored in a separate ogre directory.

Igore Vitaller
  • 163
  • 2
  • 8
  • 1
    The command line now looks like this: `g++ -L"C:\Coding\Ogre\make-debug\sdk\lib\Debug\" -L"C:\Coding\Ogre\make-debug\sdk\lib\Debug\opt\" -DDEBUG -o "OgreTestMinGW" ./BaseApplication.o ./LowLevelOgre.o -lzziplib -lzlib -lfreetype -lFreeImage -lOIS -lOgreMainStatic -lOgrePagingStatic -lOgrePropertyStatic -lOgreRTShaderSystemStatic -lOgreTerrainStatic -lRenderSystem_GLStatic` Still the same error: can't find the libraries. In any case, why should I remove the "_d"? Is that also something the ld.exe interprets somehow? Should I also remove the "_d" from the files' names on the disk, too? – TheSHEEEP Feb 03 '12 at 11:17
  • It also looks linker can't find zlib and other libs that were shippend with mingw. Could you post complete output of that command? You may need to add -L – Igore Vitaller Feb 03 '12 at 11:30
  • 1
    As I already said, every single one of those libraries resides in one of the two folders that I added with -L. And also every single one of them I compiled myself from the Ogre sources (and Ogre dependencies). That includes the zlib ones. They are definitely there. For example, there is a `"C:\Coding\Ogre\make-debug\sdk\lib\Debug\opt\RenderSystem_GLStatic_d.a"` – TheSHEEEP Feb 03 '12 at 11:33
  • As stated on http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html: "-llibrary ... The linker searches a standard list of directories for the library, which is actually a file named liblibrary.a. The linker then uses this file as if it had been specified precisely by name. " If linker can't find EVERY lib you added there are problems with either paths or names. If you have your libs named like "RenderSystem_GLStatic_d.a" - that file has no "lib" prefix. – Igore Vitaller Feb 03 '12 at 11:37
  • 1
    Yeah, my mistake. There IS a "lib" in front of the filename. In front of every filename, to be precise ;) The path IS correct. My guess is that the problem here is something completely different. – TheSHEEEP Feb 03 '12 at 11:41
  • Here is a link to show the files... [link](https://picasaweb.google.com/lh/photo/aTdwF_-JVTg81Q-Hspy6_dMTjNZETYmyPJy0liipFm0?feat=directlink) – TheSHEEEP Feb 03 '12 at 11:48
  • 2
    Hahahaha... The error was "\" in the directoy path. I replaced them with "/" and now it works. I fall for that one every single time ;) – TheSHEEEP Feb 03 '12 at 11:57
  • yep, just wanted to ask you to check that =) Good luck with 3d programming =) – Igore Vitaller Feb 03 '12 at 11:58