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

时间:2013-12-09 23:14:27

标签: c++ visual-studio visual-studio-2012 linker sfml

我对C ++很陌生,我正在使用SFML设置一个项目,工作正常,根据Visual Studio我没有代码问题,但是当我调试时,我收到以下错误信息:

  

错误1错误LNK2019:未解析的外部符号   " __ declspec(dllimport)public:__ thishisall sf :: String :: String(char   const *,class std :: locale const&)"   (_ imp ?? 0String @ sf @@ QAE @ PBDABVlocale @ std @@@ Z)在函数中引用   " public:static void __cdecl Game :: Start(void)"   (?开始@ Game @@ SAXXZ)c:\ Users \ Harley \ cppprojects \ Pong \ PongSFML \ PongSFML \ Game.obj PongSFML

     

错误2错误LNK2019:未解析的外部符号   " __ declspec(dllimport)public:_ thiscall sf :: String :: ~String(void)"   ( _imp _ ?? 1String @sf @@ QAE @ XZ)在函数" public:static中引用   void __cdecl Game :: Start(void)"   (?开始@ Game @@ SAXXZ)c:\ Users \ Harley \ cppprojects \ Pong \ PongSFML \ PongSFML \ Game.obj PongSFML

     

错误3错误LNK2019:未解析的外部符号   " __ declspec(dllimport)public:_ thiscall   sf :: VideoMode :: VideoMode(unsigned int,unsigned int,unsigned int)"   ( _imp _ ?? 0VideoMode @ sf @@ QAE @ III @ Z)在函数" public中引用:   static void __cdecl Game :: Start(void)"   (?开始@ Game @@ SAXXZ)c:\ Users \ Harley \ cppprojects \ Pong \ PongSFML \ PongSFML \ Game.obj   PongSFML

     

错误4错误LNK2019:未解析的外部符号   " __ declspec(dllimport)public:void _ thiscall   sf :: Window :: create(类sf :: VideoMode,类sf :: String const   &,unsigned int,struct sf :: ContextSettings const&)"   ( _imp_?创建@窗口@ @@ SF @ QAEXVVideoMode 2 @ ABVString @ 2 @ IABUContextSettings @ @@ 2 Z)   在函数中引用" public:static void __cdecl Game :: Start(void)"   (?开始@ Game @@ SAXXZ)c:\ Users \ Harley \ cppprojects \ Pong \ PongSFML \ PongSFML \ Game.obj PongSFML

     

错误5错误LNK2019:未解析的外部符号   " __ declspec(dllimport)public:void _ thiscall   SF ::窗口::关闭(无效)" ( _imp_?close @ Window @ sf @@ QAEXXZ)引用   in function" public:static void __cdecl Game :: Start(void)"   (?开始@ Game @@ SAXXZ)c:\ Users \ Harley \ cppprojects \ Pong \ PongSFML \ PongSFML \ Game.obj PongSFML

     

错误6错误LNK2019:未解析的外部符号   " __ declspec(dllimport)public:bool _ thiscall   sf :: Window :: pollEvent(class sf :: Event&)"   ( _imp_?pollEvent @ Window @ sf @@ QAE_NAAVEvent @ 2 @@ Z)在   function" 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 ::窗口::显示(无效)" ( _imp_?显示@窗口@ @@ SF QAEXXZ)   在函数中引用" private:static void __cdecl   游戏:: GameLoop(无效)"   (?GameLoop @ Game @@ CAXXZ)c:\ Users \ Harley \ cppprojects \ Pong \ PongSFML \ PongSFML \ Game.obj PongSFML

     

错误8错误LNK2019:未解析的外部符号   " __ declspec(dllimport)public:_ thiscall sf :: Color :: Color(unsigned   char,unsigned char,unsigned char,unsigned char)"   ( _imp _ ?? 0Color @sf @@ QAE @ EEEE @ Z)在函数" private中引用:   static void __cdecl Game :: GameLoop(void)"   (?GameLoop @ Game @@ CAXXZ)c:\ Users \ Harley \ cppprojects \ Pong \ PongSFML \ PongSFML \ Game.obj PongSFML

     

错误9错误LNK2019:未解析的外部符号   " __ declspec(dllimport)public:void _ thiscall   sf :: RenderTarget :: clear(class sf :: Color const&)"   ( _imp_?clear @ RenderTarget @ sf @@ QAEXABVColor @ 2 @@ Z)在   function" private:static void __cdecl Game :: GameLoop(void)"   (?GameLoop @ Game @@ CAXXZ)c:\ Users \ Harley \ cppprojects \ Pong \ PongSFML \ PongSFML \ Game.obj PongSFML

     

错误10错误LNK2019:未解析的外部符号   " __ declspec(dllimport)public:_ thiscall   SF :: RenderWindow的:: RenderWindow的(无效)"   ( _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)public:virtual _ thiscall   SF :: RenderWindow的::〜RenderWindow的(无效)"   ( _imp _ ?? 1RenderWindow @sf @@ UAE @ XZ)在函数"中引用   __cdecl`动态atexit析构函数用于' private:static class sf :: RenderWindow Game :: 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")

在我的主要方法之上,所以我做了。

有谁知道我做错了什么?

由于

1 个答案:

答案 0 :(得分:1)

我无法添加注释,但您可以将链接器设置为/VERBOSE,这样您就可以看到链接器找到了哪些库,以及您指定的.lib实际上是否已链接到?

设置在C ++>下;链接器>我认为进步

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