我在 visual studio 2013 中从事一个项目,然后我升级到 visual studio 2015。该项目在早期版本上没问题,但现在我收到这些错误:
1>sfml-system-s-d.lib(String.cpp.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1900' in Aircraft.obj
1>sfml-graphics-s-d.lib(VertexArray.cpp.obj) : warning LNK4049: locally defined symbol ??0_Container_base12@std@@QAE@XZ (public: __thiscall std::_Container_base12::_Container_base12(void)) imported
1>sfml-system-s-d.lib(String.cpp.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::bad_cast::bad_cast(char const *)" (__imp_??0bad_cast@std@@QAE@PBD@Z) referenced in function "class std::ctype<wchar_t> const & __cdecl std::use_facet<class std::ctype<wchar_t> >(class std::locale const &)" (??$use_facet@V?$ctype@_W@std@@@std@@YAABV?$ctype@_W@0@ABVlocale@0@@Z)
1>sfml-graphics-s-d.lib(Shader.cpp.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::bad_cast::bad_cast(char const *)" (__imp_??0bad_cast@std@@QAE@PBD@Z)
它们太多了,但我只列出了每一种。 我发现了类似的问题,但没有一个对我有用。我正在使用 SFML 库。 我为解决问题所做的步骤是: 下载适用于 vc14 的 sfml。 重建 sloution 。 尝试在预处理器命令中忽略 _MSC_VER(不再有 2038 错误,但我仍然有其他链接错误)。
没有成功...
最佳答案
用于您尝试编译的库和项目的 Visual Studio 版本不匹配。其中一些是在您使用 Visual Studio 2015 构建项目时使用 Visual Studio 2013 编译的。
如果您想使用 Visual Studio 2015 编译您的项目,您必须使用 Visual Studio 2015 编译所有必需的库(例如 SFML)(或者,如果可用,使用 VS2015 查找预构建的库)。
关于c++ - 升级到visual studio 2015后出现LNK 2038错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36703643/