在Visual Studio中实现SFML时遇到问题



这是我今天尝试了多个不同教程的结果,我似乎得到了相同的结果:

1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::CircleShape::CircleShape(float,unsigned int)" (__imp_??0CircleShape@sf@@QAE@MI@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::CircleShape::~CircleShape(void)" (__imp_??1CircleShape@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::clear(class sf::Color const &)" (__imp_?clear@RenderTarget@sf@@QAEXABVColor@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::draw(class sf::Drawable const &,class sf::RenderStates const &)" (__imp_?draw@RenderTarget@sf@@QAEXABVDrawable@2@ABVRenderStates@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABVString@1@IABUContextSettings@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class sf::RenderStates const sf::RenderStates::Default" (__imp_?Default@RenderStates@sf@@2V12@B) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class sf::Color const sf::Color::Green" (__imp_?Green@Color@sf@@2V12@B) referenced in function _main
1>C:UsersmrgnhsourcereposMy SFML GameSFML-2.5.1libsfml-graphics-d.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
1>C:UsersmrgnhsourcereposMy SFML GameSFML-2.5.1libsfml-window-d.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
1>C:UsersmrgnhsourcereposMy SFML GameSFML-2.5.1libsfml-system-d.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
1>C:UsersmrgnhsourcereposMy SFML GameSFML-2.5.1libsfml-audio-d.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
1>C:UsersmrgnhsourcereposMy SFML GameSFML-2.5.1libsfml-network-d.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
1>C:UsersmrgnhsourcereposMy SFML GameDebugMy SFML Game.exe : fatal error LNK1120: 17 unresolved externals
1>Done building project "My SFML Game.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

我没有意识到我是为x86编译的,所以我把它切换到x64。谢谢你的评论:(

最新更新