自从我上次使用C ++以来已经2年了。在过去我使用VS2008,一切都很好,现在我只是切换到VS2012,似乎我无法配置使用任何其他源和库目录,总是得到LNK2001和LNK2019错误,即使它们是我所做的确切配置与VS2008。
对不起,我虽然图像可以帮助人们检查我是否在正确的地方进行了设置。 VS2012让我很困惑。
我尝试过使用Diluculum,这是VS2012中的配置:
我不确定我的配置是否适合此版本的Visual Studio。我试图找到一种方法,但是已经有4天没有任何进程来运行简单的源代码了。这太令人沮丧了。
修改
Diluculum的错误:
1>------ Build started: Project: test, Configuration: Release Win32 ------
1>moc_mainwindow.obj : error LNK2019: unresolved external symbol "public: __thiscall Diluculum::LuaValue::LuaValue(void)" (??0LuaValue@Diluculum@@QAE@XZ) referenced in function "void __cdecl Diluculum::`dynamic initializer for 'Nil''(void)" (??__ENil@Diluculum@@YAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall Diluculum::LuaValue::LuaValue(void)" (??0LuaValue@Diluculum@@QAE@XZ)
1>mainwindow.obj : error LNK2001: unresolved external symbol "public: __thiscall Diluculum::LuaValue::LuaValue(void)" (??0LuaValue@Diluculum@@QAE@XZ)
1>moc_mainwindow.obj : error LNK2019: unresolved external symbol "public: __thiscall Diluculum::LuaValue::LuaValue(class std::map<class Diluculum::LuaValue,class Diluculum::LuaValue,struct std::less<class Diluculum::LuaValue>,class std::allocator<struct std::pair<class Diluculum::LuaValue const ,class Diluculum::LuaValue> > > const &)" (??0LuaValue@Diluculum@@QAE@ABV?$map@VLuaValue@Diluculum@@V12@U?$less@VLuaValue@Diluculum@@@std@@V?$allocator@U?$pair@$$CBVLuaValue@Diluculum@@V12@@std@@@4@@std@@@Z) referenced in function "void __cdecl Diluculum::`dynamic initializer for 'EmptyTable''(void)" (??__EEmptyTable@Diluculum@@YAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall Diluculum::LuaValue::LuaValue(class std::map<class Diluculum::LuaValue,class Diluculum::LuaValue,struct std::less<class Diluculum::LuaValue>,class std::allocator<struct std::pair<class Diluculum::LuaValue const ,class Diluculum::LuaValue> > > const &)" (??0LuaValue@Diluculum@@QAE@ABV?$map@VLuaValue@Diluculum@@V12@U?$less@VLuaValue@Diluculum@@@std@@V?$allocator@U?$pair@$$CBVLuaValue@Diluculum@@V12@@std@@@4@@std@@@Z)
1>mainwindow.obj : error LNK2001: unresolved external symbol "public: __thiscall Diluculum::LuaValue::LuaValue(class std::map<class Diluculum::LuaValue,class Diluculum::LuaValue,struct std::less<class Diluculum::LuaValue>,class std::allocator<struct std::pair<class Diluculum::LuaValue const ,class Diluculum::LuaValue> > > const &)" (??0LuaValue@Diluculum@@QAE@ABV?$map@VLuaValue@Diluculum@@V12@U?$less@VLuaValue@Diluculum@@@std@@V?$allocator@U?$pair@$$CBVLuaValue@Diluculum@@V12@@std@@@4@@std@@@Z)
1>moc_mainwindow.obj : error LNK2019: unresolved external symbol "private: void __thiscall Diluculum::LuaValue::destroyObjectAtData(void)" (?destroyObjectAtData@LuaValue@Diluculum@@AAEXXZ) referenced in function "public: void __thiscall std::_Wrap_alloc<class std::allocator<struct std::_Tree_node<struct std::pair<class Diluculum::LuaValue const ,class Diluculum::LuaValue>,void *> > >::destroy<struct std::pair<class Diluculum::LuaValue const ,class Diluculum::LuaValue> >(struct std::pair<class Diluculum::LuaValue const ,class Diluculum::LuaValue> *)" (??$destroy@U?$pair@$$CBVLuaValue@Diluculum@@V12@@std@@@?$_Wrap_alloc@V?$allocator@U?$_Tree_node@U?$pair@$$CBVLuaValue@Diluculum@@V12@@std@@PAX@std@@@std@@@std@@QAEXPAU?$pair@$$CBVLuaValue@Diluculum@@V12@@1@@Z)
1>main.obj : error LNK2001: unresolved external symbol "private: void __thiscall Diluculum::LuaValue::destroyObjectAtData(void)" (?destroyObjectAtData@LuaValue@Diluculum@@AAEXXZ)
1>mainwindow.obj : error LNK2001: unresolved external symbol "private: void __thiscall Diluculum::LuaValue::destroyObjectAtData(void)" (?destroyObjectAtData@LuaValue@Diluculum@@AAEXXZ)
1>C:\Users\User\documents\visual studio 2012\Projects\test\Win32\Release\\test.exe : fatal error LNK1120: 3 unresolved externals
==========构建:0成功,1失败,0最新,0跳过==========
答案 0 :(得分:0)
好像你正在链接库的静态版本。这意味着,您的CRT包含在这些库中。但CRT对于不同版本的Visual Studio是不同的。您只能对在完全相同的Visual Studio中编译的版本使用静态链接。
在SFML download page,有不同版本的Visual Studio包。