C++;Visual Studio 2012链接器错误? 我对C++非常陌生,我用SFML来创建一个项目,它工作得很好,我没有VisualStudio的代码问题,但是当我调试时,我得到这些错误信息:

C++;Visual Studio 2012链接器错误? 我对C++非常陌生,我用SFML来创建一个项目,它工作得很好,我没有VisualStudio的代码问题,但是当我调试时,我得到这些错误信息:,c++,visual-studio,visual-studio-2012,linker,sfml,C++,Visual Studio,Visual Studio 2012,Linker,Sfml,错误1错误LNK2019:未解析的外部符号 “_declspec(dllimport)public:_thiscall sf::String::String(char 常量*,类std::locale const&) (_imp??0String@sf@@QAE@PBDABVlocale@std@@@Z)在函数中引用 “公共:静态无效\uuuCDECL游戏::开始(无效)” (?Start@Game@@SAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML

错误1错误LNK2019:未解析的外部符号 “_declspec(dllimport)public:_thiscall sf::String::String(char 常量*,类std::locale const&) (_imp??0String@sf@@QAE@PBDABVlocale@std@@@Z)在函数中引用 “公共:静态无效\uuuCDECL游戏::开始(无效)” (?Start@Game@@SAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

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

错误3错误LNK2019:未解析的外部符号 “\u declspec(dllimport)public:\u thiscall sf::VideoMode::VideoMode(无符号整数、无符号整数、无符号整数)” (_imp_u???)??0VideoMode@sf@@QAE@III@Z) 在“公共”功能中引用: 静态无效\uuuCDECL游戏::开始(无效)” (?Start@Game@@SAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj 彭斯梅尔

错误4错误LNK2019:未解析的外部符号 “\u declspec(dllimport)公共:无效\u此调用 sf::Window::create(类sf::VideoMode,类sf::字符串常量 &,unsigned int,struct sf::ContextSettings const&) (_imp_)?create@Window@科幻小说@@QAEXVVideoMode@2@ABVString@2@IABUContextSettings@2@@Z) 在函数“public:static void\uu cdecl Game::Start(void)”中引用 (?Start@Game@@SAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

错误5错误LNK2019:未解析的外部符号 “\u declspec(dllimport)公共:无效\u此调用 sf::Window::close(void)“(\u imp\ux?close@Window@sf@@qaexz)已引用 在函数“public:staticvoid\uu cdecl Game::Start(void)”中 (?Start@Game@@SAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

错误6错误LNK2019:未解析的外部符号 “uu declspec(dllimport)公共:bool\u thiscall sf::Window::pollEvent(类sf::Event&)” (_imp_)?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) 引用于 函数“private:staticvoid\uu cdecl Game::GameLoop(void)” (?GameLoop@Game@@CAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

错误7错误LNK2019:未解析的外部符号 “\u declspec(dllimport)公共:无效\u此调用 sf::窗口::显示(无效)“(\u imp\u0)?display@Window@sf@@qaexz) 在函数“private:static void\uu cdecl”中引用 游戏::游戏循环(无效)” (?GameLoop@Game@@CAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

错误8错误LNK2019:未解析的外部符号 “\u declspec(dllimport)public:\u thiscall sf::Color::Color(未签名) 字符,无符号字符,无符号字符,无符号字符“ (_imp_u???)??0Color@sf@@QAE@EEEE@Z) 在函数“private: 静态无效\uuuCDECL游戏::游戏循环(无效)” (?GameLoop@Game@@CAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

错误9错误LNK2019:未解析的外部符号 “\u declspec(dllimport)公共:无效\u此调用 sf::RenderTarget::clear(类sf::Color const&) (_imp_)?clear@RenderTarget@科幻小说@@QAEXABVColor@2@@Z) 引用于 函数“private:staticvoid\uu cdecl Game::GameLoop(void)” (?GameLoop@Game@@CAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

错误10错误LNK2019:未解析的外部符号 “\u declspec(dllimport)public:\u thiscall sf::RenderWindow::RenderWindow(无效)” (_imp_u???)??0RenderWindow@sf@@QAE@XZ)在函数“void”中引用 __cdecl“私有:静态类sf::RenderWindow游戏::主窗口”的动态初始值设定项(无效) (?)_mainWindow@Game@@0VRenderWindow@sf@@A@@YAXXZ)c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

错误11错误LNK2019:未解析的外部符号 “\u declspec(dllimport)public:virtual\u thiscall sf::RenderWindow::~RenderWindow(无效)” (_imp_u???)??1RenderWindow@sf@@UAE@XZ)在函数“void”中引用 __cdecl“私有:静态类sf::RenderWindow游戏::主窗口”的动态atexit析构函数(无效) (??\u 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-main-d.lib;sfml-audio-d.lib;sfml-system-d.lib;sfml-window-d.lib;sfml-graphics-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++ >链接器>我认为


编辑:我不知道怎么做。你是指C++中的属性吗?我检查了C++中的属性区域,没有链接器。将“显示进度”字段设置为/VBBOSE。