Ogre1.6.5 编译链接错误之FreeImage

这两天想重新学习下ogre,但是在vs2010上编译1.6.5的版本上遇到链接失败的问题,耗了不少时间这里记一下。

主要是一些重定义报错。

>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::operator<<(float)" (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@M@Z) 已经在 FreeImaged.lib(half.obj) 中定义。

失败环境:

OgreMain是debug版的dll动态库工程,runtime library选的是"多线程调试 DLL (/MDd)"。FreeImage选择的是对应的3.10.0。并且FreeImageLib工程的runtime library也是"多线程调试 DLL (/MDd)"。

按道理来说是不应该出现链接错误的,因为是lib工程和最终需要的dll工程的配置是一样的。

问题和解决方法:

FreeImageLib工程编译出的lib库有问题,不能只把FreeImageLib的runtime library设置为"多线程调试 DLL (/MDd)",需要把它依赖的所有FreeImage工程的Runtime Library都设置为"多线程调试 DLL (/MDd)"。

FreeImage工程如下:

runtime配置如下:

 另外对应版本的ogre和freeimage源代码可以去sourceforge上搜索。

 

原文地址:https://www.cnblogs.com/beeasy/p/6079162.html