使用 SFML,获取"Unresolved External Symbol"输出
Working With SFML, getting "Unresolved External Symbol" Output
所以我正在制作一个pong克隆,目前我正在编译它,输出如下:
1>------ Build started: Project: Pong, Configuration: Debug Win32 ------
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Image::Create(unsigned int,unsigned int,class sf::Color const &)" (__imp_?Create@Image@sf@@QAEXIIABVColor@2@@Z) referenced in function "public: void __thiscall Display::load_resources(void)" (?load_resources@Display@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QAE@EEEE@Z) referenced in function "public: void __thiscall Display::load_resources(void)" (?load_resources@Display@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Texture::LoadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class sf::Rect<int> const &)" (__imp_?LoadFromFile@Texture@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$Rect@H@2@@Z) referenced in function "public: void __thiscall Display::load_resources(void)" (?load_resources@Display@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Font::LoadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?LoadFromFile@Font@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: void __thiscall Display::load_resources(void)" (?load_resources@Display@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::SetTexture(class sf::Texture const &,bool)" (__imp_?SetTexture@Sprite@sf@@QAEXABVTexture@2@_N@Z) referenced in function "public: void __thiscall Display::loadSprites(void)" (?loadSprites@Display@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Sprite::~Sprite(void)" (__imp_??1Sprite@sf@@UAE@XZ) referenced in function "public: void __thiscall Ball::setSprite(class sf::Sprite)" (?setSprite@Ball@@QAEXVSprite@sf@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Sprite & __thiscall sf::Sprite::operator=(class sf::Sprite const &)" (__imp_??4Sprite@sf@@QAEAAV01@ABV01@@Z) referenced in function "public: void __thiscall Ball::setSprite(class sf::Sprite)" (?setSprite@Ball@@QAEXVSprite@sf@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Sprite::Sprite(void)" (__imp_??0Sprite@sf@@QAE@XZ) referenced in function "public: __thiscall Ball::Ball(void)" (??0Ball@@QAE@XZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Transformable::SetPosition(float,float)" (__imp_?SetPosition@Transformable@sf@@QAEXMM@Z) referenced in function "public: void __thiscall Ball::updateSprite(void)" (?updateSprite@Ball@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Image::~Image(void)" (__imp_??1Image@sf@@QAE@XZ) referenced in function __unwindfunclet$??0Display@@QAE@XZ$0
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::~Texture(void)" (__imp_??1Texture@sf@@QAE@XZ) referenced in function __unwindfunclet$??0Display@@QAE@XZ$0
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Font::~Font(void)" (__imp_??1Font@sf@@QAE@XZ) referenced in function __unwindfunclet$??0Display@@QAE@XZ$0
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Image::Image(void)" (__imp_??0Image@sf@@QAE@XZ) referenced in function "public: __thiscall Display::Display(void)" (??0Display@@QAE@XZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::Texture(void)" (__imp_??0Texture@sf@@QAE@XZ) referenced in function "public: __thiscall Display::Display(void)" (??0Display@@QAE@XZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Font::Font(void)" (__imp_??0Font@sf@@QAE@XZ) referenced in function "public: __thiscall Display::Display(void)" (??0Display@@QAE@XZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Sprite::Sprite(class sf::Sprite const &)" (__imp_??0Sprite@sf@@QAE@ABV01@@Z) referenced in function "public: void __thiscall Game::reset(void)" (?reset@Game@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static bool __cdecl sf::Keyboard::IsKeyPressed(enum sf::Keyboard::Key)" (__imp_?IsKeyPressed@Keyboard@sf@@SA_NW4Key@12@@Z) referenced in function "public: void __thiscall Game::update(void)" (?update@Game@@QAEXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Close(void)" (__imp_?Close@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABUContextSettings@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>C:UsersOwnerDocumentsVisual Studio 2010ProjectsPongDebugPong.exe : fatal error LNK1120: 22 unresolved externals
我所读到的都说我链接错误,但我在包含部分中有所有需要的文件。。。我做错了什么?
如果要链接静态SFML库,则需要在项目配置的预处理器部分中定义SFML_static。
如果不这样做,您将得到__declspec(dllimport)相关的链接错误,因为标头不再与它们所使用的库匹配。
相关文章:
- CppSQLite 抛出"LNK2019: unresolved external symbol"错误
- Visual Studio中的wxwidgets应用程序给出错误"LNK2019 unresolved external symbol"
- 在 C++ 中嵌入 V8 会导致与 libcpp 相关的"unrecognized external symbol"错误
- 我的游戏引擎的 spdlog 日志记录出现奇怪的"unresolved external symbol"错误
- 如何修复"unresolved external symbol _gladLoadGLLoader referenced in function _main"和"unresolved external
- 通过覆盖虚拟函数来获取'unresolved external symbol'
- 运行时动态加载库时出错"unresolved external symbol"
- 为什么 VS C++链接器返回具有混合 DLL 转发的"LNK2001: unresolved external symbol"?
- Visual Studio 2017 中的 MySQL 连接器/C++ 错误"Unresolved external symbol _get_driver_instance"
- CMake 和 Visual Studio 出现"unresolved external symbol"错误
- DLL 注入编译 "unresolved external symbol" Visual Studio C++
- "Error LNK2001: unresolved external symbol _main"仍然存在
- QT 单元测试 moc "unresolved external symbol" for QMetaObject
- 主外部功能的C++ "unresolved external symbol"
- 错误 : "error LNK2019: unresolved external symbol"
- 为什么我的代码生成"Unresolved external symbol"错误?
- 使用三角形库时的"unresolved external symbol _triangulate"
- 如何修复" Error LNK2019 : unresolved external symbol ... "
- 问题:"error LNK2019: unresolved external symbol"
- 为什么我会收到"unresolved external symbol"消息?