SFML community forums

Help => General => Topic started by: wademcgillis on October 12, 2011, 08:21:14 pm

Title: SFML2 doesn't link - VS 2008
Post by: wademcgillis on October 12, 2011, 08:21:14 pm
:evil:

My project no longer links when I use SFML2 in Visual Studio 2008

Yes, I am linking to the SFML2 static libs.
Yes, the files do exist.

Code: [Select]

1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Shape __cdecl sf::Shape::Rectangle(float,float,float,float,class sf::Color const &,float,class sf::Color const &)" (__imp_?Rectangle@Shape@sf@@SA?AV12@MMMMABVColor@2@M0@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Shape __cdecl sf::Shape::Line(float,float,float,float,float,class sf::Color const &,float,class sf::Color const &)" (__imp_?Line@Shape@sf@@SA?AV12@MMMMMABVColor@2@M0@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Drawable::SetColor(class sf::Color const &)" (__imp_?SetColor@Drawable@sf@@QAEXABVColor@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Drawable::SetScale(float,float)" (__imp_?SetScale@Drawable@sf@@QAEXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Drawable::SetPosition(float,float)" (__imp_?SetPosition@Drawable@sf@@QAEXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual unsigned int __thiscall sf::RenderWindow::GetHeight(void)const " (__imp_?GetHeight@RenderWindow@sf@@UBEIXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual unsigned int __thiscall sf::RenderWindow::GetWidth(void)const " (__imp_?GetWidth@RenderWindow@sf@@UBEIXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(void)" (__imp_??0RenderWindow@sf@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Show(bool)" (__imp_?Show@Window@sf@@QAEX_N@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::PollEvent(class sf::Event &)" (__imp_?PollEvent@Window@sf@@QAE_NAAVEvent@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::IsOpened(void)const " (__imp_?IsOpened@Window@sf@@QBE_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Create(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::ContextSettings const &)" (__imp_?Create@Window@sf@@QAEXVVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUContextSettings@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Texture::LoadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class sf::Rect<int> const &)" (__imp_?LoadFromFile@Texture@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$Rect@H@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::~Texture(void)" (__imp_??1Texture@sf@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::Texture(void)" (__imp_??0Texture@sf@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::SetSubRect(class sf::Rect<int> const &)" (__imp_?SetSubRect@Sprite@sf@@QAEXABV?$Rect@H@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::SetTexture(class sf::Texture const &,bool)" (__imp_?SetTexture@Sprite@sf@@QAEXABVTexture@2@_N@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Sprite::Sprite(void)" (__imp_??0Sprite@sf@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Color const sf::Color::Red" (__imp_?Red@Color@sf@@2V12@B)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::Draw(class sf::Drawable const &)" (__imp_?Draw@RenderTarget@sf@@QAEXABVDrawable@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::Clear(class sf::Color const &)" (__imp_?Clear@RenderTarget@sf@@QAEXABVColor@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QAE@EEEE@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Shape::~Shape(void)" (__imp_??1Shape@sf@@UAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Sprite::~Sprite(void)" (__imp_??1Sprite@sf@@UAE@XZ)
Title: SFML2 doesn't link - VS 2008
Post by: Nexus on October 12, 2011, 09:32:02 pm
__declspec(dllimport) indicates that the linker is searching for the dynamic libraries.

Did you define SFML_STATIC?
Title: SFML2 doesn't link - VS 2008
Post by: wademcgillis on October 12, 2011, 11:13:09 pm
Quote from: "Nexus"
__declspec(dllimport) indicates that the linker is searching for the dynamic libraries.

Did you define SFML_STATIC?


Yes.

I solved it by fiddling around with options in CMake.  :lol:

Thanks anyway though.