我试图编译SFGUI库 - 它是SFML的GUI。我正在遵循这些说明http://sfgui.sfml-dev.de/p/docs/guide/installing。
首先,我使用CMake生成makefile - 我已将生成器设置为 NMake Makefiles ,然后 Visual Studio 2012 。然后我尝试使用NMake和Visual Studio 2013编译它。两者都产生了如下所示的相同错误。
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::begin(void)const " (__imp_?begin@String@sf@@QBE?AV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) referenced in function "public: class sf::Vector2<float> __thiscall sfg::Engine::GetTextMetricsA(class sf::String const &,class sf::Font const &,unsigned int)const " (?GetTextMetricsA@Engine@sfg@@QBE?AV?$Vector2@M@sf@@ABVString@4@ABVFont@4@I@Z) C:\Program Files (x86)\CMake 2.8\bin\Engine.obj sfgui
Error 2 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::begin(void)const " (__imp_?begin@String@sf@@QBE?AV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) C:\Program Files (x86)\CMake 2.8\bin\Renderer.obj sfgui
Error 3 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::begin(void)const " (__imp_?begin@String@sf@@QBE?AV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) C:\Program Files (x86)\CMake 2.8\bin\Window.cpp.obj sfgui
Error 4 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::begin(void)const " (__imp_?begin@String@sf@@QBE?AV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) C:\Program Files (x86)\CMake 2.8\bin\Entry.cpp.obj sfgui
Error 5 error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::end(void)const " (__imp_?end@String@sf@@QBE?AV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) referenced in function "public: class sf::Vector2<float> __thiscall sfg::Engine::GetTextMetricsA(class sf::String const &,class sf::Font const &,unsigned int)const " (?GetTextMetricsA@Engine@sfg@@QBE?AV?$Vector2@M@sf@@ABVString@4@ABVFont@4@I@Z) C:\Program Files (x86)\CMake 2.8\bin\Engine.obj sfgui
Error 6 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::end(void)const " (__imp_?end@String@sf@@QBE?AV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) C:\Program Files (x86)\CMake 2.8\bin\Renderer.obj sfgui
Error 7 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::end(void)const " (__imp_?end@String@sf@@QBE?AV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) C:\Program Files (x86)\CMake 2.8\bin\Window.cpp.obj sfgui
Error 8 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::_String_const_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::end(void)const " (__imp_?end@String@sf@@QBE?AV?$_String_const_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) C:\Program Files (x86)\CMake 2.8\bin\Entry.cpp.obj sfgui
Error 9 error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::_String_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::begin(void)" (__imp_?begin@String@sf@@QAE?AV?$_String_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) referenced in function "private: unsigned int __thiscall sfg::Entry::GetPositionFromMouseX(int)" (?GetPositionFromMouseX@Entry@sfg@@AAEIH@Z) C:\Program Files (x86)\CMake 2.8\bin\Entry.cpp.obj sfgui
Error 10 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::_String_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::begin(void)" (__imp_?begin@String@sf@@QAE?AV?$_String_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) C:\Program Files (x86)\CMake 2.8\bin\Label.cpp.obj sfgui
Error 11 error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::_String_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::end(void)" (__imp_?end@String@sf@@QAE?AV?$_String_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) referenced in function "private: unsigned int __thiscall sfg::Entry::GetPositionFromMouseX(int)" (?GetPositionFromMouseX@Entry@sfg@@AAEIH@Z) C:\Program Files (x86)\CMake 2.8\bin\Entry.cpp.obj sfgui
Error 12 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::_String_iterator<class std::_String_val<struct std::_Simple_types<unsigned int> > > __thiscall sf::String::end(void)" (__imp_?end@String@sf@@QAE?AV?$_String_iterator@V?$_String_val@U?$_Simple_types@I@std@@@std@@@std@@XZ) C:\Program Files (x86)\CMake 2.8\bin\Label.cpp.obj sfgui
Error 13 error LNK1120: 4 unresolved externals C:\Program Files (x86)\CMake 2.8\bin\Debug\sfgui-d.dll sfgui
你知道怎么解决吗?我在互联网上搜索答案,但它没有帮助我。它是库,而不是我的项目,所以我不应该更改代码。
答案 0 :(得分:0)
此类sf::String
不是由 SFGUI 本身提供,而是由底层的跨平台库 SFML 提供。好像它的库没有正确地包含在构建中。
确保在CMake运行期间找到正确的 SFML ,检查其.lib二进制文件是否在正确的位置(而不仅仅是包含)生成,查看运行时是否指定了这些库{{ 1}}在link.exe
等的输出中。还要重新检查 SFML 之前是否已正确构建,检查其中是否有可能的安装步骤等等。