【发布时间】:2016-11-10 00:23:59
【问题描述】:
在完全重新格式化并从 Visual Studio 2012 升级到 2015 之后,我的程序将无法编译并会向我吐出链接器错误。我查看了路径、链接器和诸如此类的东西,它看起来就像它应该工作的那样,我也在引用的类中查看了我的代码,但它们也都设置了正确的包含和命名空间。
所有文件,包括 SFML 库和我自己的源代码,在我重新格式化之前都保存在我的 Dropbox 中,因此没有文件更改文件夹,我也仔细检查了这些文件夹。
整个项目都是用 C++ 编写的
1>------ Build started: Project: Starfall, Configuration: Debug x64 ------
1>AnimatedSprite.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::RectangleShape & __cdeclsf::RectangleShape::operator=(class sf::RectangleShape &&)" (__imp_??4RectangleShape@sf@@QEAAAEAV01@$$QEAV01@@Z) referenced in function "public: __cdecl AnimatedSprite::AnimatedSprite(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct HandlerContainer *)" (??0AnimatedSprite@@QEAA@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAUHandlerContainer@@@Z)
1>DynamicSprite.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class sf::RectangleShape & __cdecl sf::RectangleShape::operator=(class sf::RectangleShape &&)" (__imp_??4RectangleShape@sf@@QEAAAEAV01@$$QEAV01@@Z)
1>CuboidDrawable.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::ConvexShape & __cdecl sf::ConvexShape::operator=(class sf::ConvexShape &&)" (__imp_??4ConvexShape@sf@@QEAAAEAV01@$$QEAV01@@Z) referenced in function "public: __cdecl CuboidDrawable::CuboidDrawable(class CuboidShape,struct HandlerContainer *)" (??0CuboidDrawable@@QEAA@VCuboidShape@@PEAUHandlerContainer@@@Z)
1>C:\Users\Riilu\Dropbox\Starfall\Code and shit\Starfall\x64\Debug\Starfall.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
【问题讨论】:
-
您是否也将 SFML 库升级到 VS2015?阅读here - “您必须下载与您的 Visual C++ 版本匹配的包。...如果没有为您的 Visual C++ 版本编译的 SFML 包,您将必须自己构建 SFML”
-
哦,哈哈,我没有意识到,对不起。
-
@mvidelgauz 将此作为答案而不是评论:)。
-
@Lehu 我怀疑 OP 甚至会用相同的用户名登录来接受这个答案(清理“未回答的问题”列表),但我遵循了你的要求 :)
标签: c++ linker dependencies sfml