我的解决方案昨天建成今天除了.hpp和.cpp文件之外什么也没改变.
Visual Studio 2013中的完整错误文本(使用2013年11月的CTP):
Error 1 error LNK2005: __xi_a already defined in MSVCRT.lib(cinitexe.obj) C:\Users\drtwox\dev\repos\game\trunk\engine\game\LIBCMT.lib(crt0init.obj) game
Error 2 error LNK2005: __xi_z already defined in MSVCRT.lib(cinitexe.obj) C:\Users\drtwox\dev\repos\game\trunk\engine\game\LIBCMT.lib(crt0init.obj) game
Error 3 error LNK2005: __xc_a already defined in MSVCRT.lib(cinitexe.obj) C:\Users\drtwox\dev\repos\game\trunk\engine\game\LIBCMT.lib(crt0init.obj) game
Error 4 error LNK2005: __xc_z already defined in MSVCRT.lib(cinitexe.obj) C:\Users\drtwox\dev\repos\game\trunk\engine\game\LIBCMT.lib(crt0init.obj) game
Error 7 error LNK1169: one or more multiply defined symbols found C:\Users\drtwox\dev\repos\game\trunk\engine\build\x64\Test\game.exe 1 1 game
关于捅眼睛有用…
You are mixing code that was compiled with /MD (use DLL version of
CRT) with code that was compiled with /MT (use static CRT library).
That cannot work,all source code files must be compiled with the same
setting. Given that you use libraries that were pre-compiled with /MD,
almost always the correct setting,you must compile your own code with
this setting as well.
我已检查(并重新检查)解决方案中的所有项目仍在使用相同的运行时库;用于发布的多线程DLL和用于调试的多线程调试DLL.我完成了一个完整的解决方案重建,以确保.
Subversion日志显示自2013-12-04以来未包含所有第三方库的“外部”目录;一个月前.我检查了他们的配置并重建了它们.
Subversion日志还显示自昨天以来仅修改了现有的.hpp和.cpp文件.没有添加新库,没有新的外部头文件#included,也没有更改项目配置.在7个文件中有超过200行已更改和新代码.
可能是什么问题呢?
解决方案:问题不是错误/ MT / MD编译器标志,它是GLEW库和缺少#define GLEW_STATIC.我将GLEW项目设置更改为使用/ Zl(忽略默认库名称),如下所示:@L_502_3@.