visual studio 2012 - SFGUI/ c++编译问题.错误2019:未解析的外部符号



我正在尝试编译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.8binEngine.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.8binRenderer.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.8binWindow.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.8binEntry.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.8binEngine.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.8binRenderer.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.8binWindow.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.8binEntry.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.8binEntry.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.8binLabel.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.8binEntry.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.8binLabel.cpp.obj  sfgui
Error   13  error LNK1120: 4 unresolved externals   C:Program Files (x86)CMake 2.8binDebugsfgui-d.dll  sfgui

你知道怎么修理它吗?我在网上搜索答案,但它没有帮助我。这是一个库,不是我的项目,所以我不应该修改代码。

这个类sf::String不是由SFGUI本身提供的,而是由底层跨平台库SFML提供的。似乎它的库没有正确地包含在构建中。

确保在CMake运行期间正确找到SFML,检查其.lib二进制文件是否在正确的位置生成(不仅仅是包含),查看这些库是否在nmake VERBOSE=1等输出中运行link.exe时指定。还要重新检查SFML之前是否正确构建,检查其中可能的安装步骤等等。

最新更新