繁体   English   中英

C ++ Visual Studio 2012链接器错误?

[英]C++ Visual Studio 2012 Linker Errors?

我是C ++的新手,我正在使用SFML设置项目,效果很好,根据Visual Studio,我没有任何代码问题,但是在调试时,我收到了以下错误消息:

错误1错误LNK2019:无法解析的外部符号“ __declspec(dllimport)公共:__thiscall sf :: String :: String(char const *,class std :: locale const&)”(_ imp ?? 0String @ sf @@ QAE @ PBDABVlocale函数“ public:static void __cdecl Game :: Start(void)”(?Start @ Game @@ SAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game中引用了@std @@@@ Z)。 obj PongSFML

错误2错误LNK2019:无法解析的外部符号“ __declspec(dllimport)public:_ thiscall sf :: String :: 〜String (void)”( _imp _ ?? 1String @ sf @@ QAE @ XZ)在函数“ public:static void中引用__cdecl Game :: Start(void)”(?Start @ Game @@ SAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误3错误LNK2019:无法解析的外部符号“ __declspec(dllimport)公共:_ thiscall sf :: VideoMode :: VideoMode(unsigned int,unsigned int,unsigned int)”( _imp _ ?? 0VideoMode @ sf @@ QAE @ III @ Z)在函数“公共:静态void __cdecl Game :: Start(void)”中引用(?Start @ Game @@ SAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误4错误LNK2019:无法解析的外部符号“ __declspec(dllimport)public:void _ thiscall sf :: Window :: create(class sf :: VideoMode,class sf :: String const&,unsigned int,struct sf :: ContextSettings const& )”( _imp_?create @ Window @ sf @@ QAEXVVideoMode @ 2 @ ABVString @ 2 @ IABUContextSettings @ 2 @@ Z)在函数“ public:static void __cdecl Game :: Start(void)”中引用(?Start @ Game @ @SAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误5错误LNK2019:未解析的外部符号“ __declspec(dllimport)public:void _ thiscall sf :: Window :: close(void)”( _imp_?close @ Window @ sf @@ QAEXXZ)在函数“ public:static void __cdecl中引用” Game :: Start(void)“(?Start @ Game @@ SAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误6错误LNK2019:未解析的外部符号“ __declspec(dllimport)公共:bool _此调用sf :: Window :: pollEvent(class sf :: Event&)”( _imp_?pollEvent @ Window @ sf @@ QAE_NAAVEvent @ 2 @@ Z )在函数“ private:static void __cdecl Game :: GameLoop(void)”中引用(?GameLoop @ Game @@ CAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误7错误LNK2019:无法解析的外部符号“ __declspec(dllimport)public:void _ thiscall sf :: Window :: display(void)”( _imp_?display @ Window @ sf @@ QAEXXZ)在函数“ private:static void __cdecl中引用Game :: GameLoop(void)”(?GameLoop @ Game @@ CAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误8错误LNK2019:无法解析的外部符号“ __declspec(dllimport)公共:_ thiscall sf :: Color :: Color(unsigned char,unsigned char,unsigned char,unsigned char)”( _imp _ ?? 0Color @ sf @@ QAE @ EEEE @Z)在函数“私有:静态void __cdecl Game :: GameLoop(void)”中引用(?GameLoop @ Game @@ CAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误9错误LNK2019:未解析的外部符号“ __declspec(dllimport)公共:void _此调用sf :: RenderTarget :: clear(class sf :: Color const&)”( _imp_?clear @ RenderTarget @ sf @@ QAEXABVColor @ 2 @@ Z)在函数“私人:静态void __cdecl Game :: GameLoop(void)”中引用(?GameLoop @ Game @@ CAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误10错误LNK2019:未解析的外部符号“ __declspec(dllimport)公共:_ thiscall sf :: RenderWindow :: RenderWindow(void)”( _imp _ ?? 0RenderWindow @ sf @@ QAE @ XZ)在函数“ void __cdecl动态初始化程序”中引用适用于'private:static class sf :: RenderWindow Game :: mainWindow''(void)“(?? _E?_mainWindow @ Game @@ 0VRenderWindow @ sf @@ A @@ YAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误11错误LNK2019:未解析的外部符号“ __declspec(dllimport)公共:虚拟_ thiscall sf :: RenderWindow :: 〜RenderWindow (void)”( _imp _ ?? 1RenderWindow @ sf @@ UAE @ XZ)在函数“ void __cdecl`”中引用动态私有属性的析构函数,用于“私有:静态类sf :: RenderWindow游戏:: mainWindow''(void)“(?? _F?_mainWindow @ Game @@ 0VRenderWindow @ sf @@ A @@ YAXXZ)c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ PongSFML \\ Game.obj PongSFML

错误12错误LNK1120:11无法解析的外部文件c:\\ Users \\ Harley \\ cppprojects \\ Pong \\ PongSFML \\ Debug \\ PongSFML.exe 1 1 PongSFML

为了解决这个问题,我已经进行了大量研究,但是没有任何建议有效或完全没有任何改变。 我检查了我的其他依赖项,但没有出现任何拼写错误:

SFML-主d.lib; SFML-音频d.lib; SFML系统-d.lib; SFML窗口-d.lib; SFML-图形d.lib;

我的发布依赖项:

SFML-system.lib; SFML-window.lib; SFML-GRAPHICS.LIB; SFML-audio.lib; KERNEL32.LIB; USER32.LIB; GDI32.LIB; winspool.lib; comdlg32.lib; advapi32.lib; SHELL32。 LIB; ole32.lib; oleaut32.lib; UUID.LIB; odbc32.lib; odbccp32.lib;

再一次,我是C ++的新手,所以我可能在做一些非常愚蠢的事情。 我认为我的源代码与它无关,但是有人建议我添加

#pragma comment(lib, "sfml-main-d.lib")
#pragma comment(lib, "sfml-system-d.lib")
#pragma comment(lib, "sfml-window-d.lib")
#pragma comment(lib, "sfml-graphics-d.lib")

以上是我的主要方法,所以我做到了。

有人知道我在做什么错吗?

谢谢

我无法添加评论,但是可以将链接器设置为/VERBOSE以便可以看到链接器找到了哪些库,以及指定的.lib是否实际上已链接到其中?

我认为该设置在C ++>链接器>进度下

编辑: http : //s30.postimg.org/485cmfnk1/temp.png <-这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM