Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED] Linker problem (only occurring with release)  (Read 16241 times)

0 Members and 1 Guest are viewing this topic.

AndrewB

  • Newbie
  • *
  • Posts: 33
    • View Profile
[SOLVED] Linker problem (only occurring with release)
« on: December 13, 2012, 05:27:46 am »
Hello everyone I am having the following linker problems:
(I have double checked the linker options in my project properties)

1>colorManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(void)" (__imp_??0Color@sf@@QAE@XZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: virtual bool __thiscall sf::RenderWindow::activate(bool)" (__imp_?activate@RenderWindow@sf@@EAE_N_N@Z)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: virtual void __thiscall sf::RenderWindow::onResize(void)" (__imp_?onResize@RenderWindow@sf@@MAEXXZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: virtual void __thiscall sf::RenderWindow::onCreate(void)" (__imp_?onCreate@RenderWindow@sf@@MAEXXZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class sf::Vector2<unsigned int> __thiscall sf::RenderWindow::getSize(void)const " (__imp_?getSize@RenderWindow@sf@@UBE?AV?$Vector2@I@2@XZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABUContextSettings@1@@Z)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::setFramerateLimit(unsigned int)" (__imp_?setFramerateLimit@Window@sf@@QAEXI@Z)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::close(void)" (__imp_?close@Window@sf@@QAEXXZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::~Texture(void)" (__imp_??1Texture@sf@@QAE@XZ)
1>engine.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: 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::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Transformable::setPosition(float,float)" (__imp_?setPosition@Transformable@sf@@QAEXMM@Z)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::RenderStates const sf::RenderStates::Default" (__imp_?Default@RenderStates@sf@@2V12@B)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: virtual void __thiscall sf::Sprite::draw(class sf::RenderTarget &,class sf::RenderStates)const " (__imp_?draw@Sprite@sf@@EBEXAAVRenderTarget@2@VRenderStates@2@@Z)
1>splashState.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>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Sprite::Sprite(void)" (__imp_??0Sprite@sf@@QAE@XZ)
1>splashState.obj : error LNK2001: 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)
1>splashState.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>splashState.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>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Sprite::~Sprite(void)" (__imp_??1Sprite@sf@@UAE@XZ)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: virtual void __thiscall sf::Shape::draw(class sf::RenderTarget &,class sf::RenderStates)const " (__imp_?draw@Shape@sf@@EBEXAAVRenderTarget@2@VRenderStates@2@@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Shape::setFillColor(class sf::Color const &)" (__imp_?setFillColor@Shape@sf@@QAEXABVColor@2@@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Color const sf::Color::Green" (__imp_?Green@Color@sf@@2V12@B)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Transformable::setPosition(class sf::Vector2<float> const &)" (__imp_?setPosition@Transformable@sf@@QAEXABV?$Vector2@M@2@@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class sf::Vector2<float> __thiscall sf::CircleShape::getPoint(unsigned int)const " (__imp_?getPoint@CircleShape@sf@@UBE?AV?$Vector2@M@2@I@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual unsigned int __thiscall sf::CircleShape::getPointCount(void)const " (__imp_?getPointCount@CircleShape@sf@@UBEIXZ)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::CircleShape::CircleShape(float,unsigned int)" (__imp_??0CircleShape@sf@@QAE@MI@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::CircleShape::~CircleShape(void)" (__imp_??1CircleShape@sf@@UAE@XZ)
1>textureManager.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>textureManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::Texture(void)" (__imp_??0Texture@sf@@QAE@XZ)
1>textureManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::Texture(class sf::Texture const &)" (__imp_??0Texture@sf@@QAE@ABV01@@Z)
1>D:\Projects\Gentlemen_Wanderer\Release\Gentlemen_Wanderer.exe : fatal error LNK1120: 34 unresolved externals

This happens when I try and build my project in release mode, when I build in debug it works fine.
Is there something wrong with my release lib files?
« Last Edit: December 13, 2012, 10:21:56 am by AndrewB »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linker problem (only occurring with release)
« Reply #1 on: December 13, 2012, 07:49:58 am »
Don't forget to link to sfml-graphics.
Laurent Gomila - SFML developer

AndrewB

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Linker problem (only occurring with release)
« Reply #2 on: December 13, 2012, 08:32:46 am »


I can also confirm that sfml-graphics-s.lib exists in my lib directory

cf

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Linker problem (only occurring with release)
« Reply #3 on: December 13, 2012, 08:38:28 am »
Quote
The settings shown here will result in your application being linked to the dynamic version of SFML, the one that needs the DLL files. If you want to get rid of these DLLs and have SFML directly integrated to your executable, you must link to the static version. Static SFML libraries have the "-s" suffix: "sfml-xxx-s-d.lib" for Debug, and "sfml-xxx-s.lib" for Release. In this case, you'll also need to define the SFML_STATIC macro in the preprocessor options of your project.
Tutorial - Getting started - SFML and Visual C++

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: Linker problem (only occurring with release)
« Reply #4 on: December 13, 2012, 10:15:19 am »
add SFML_STATIC to preprocessor

AndrewB

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Linker problem (only occurring with release)
« Reply #5 on: December 13, 2012, 10:21:39 am »
add SFML_STATIC to preprocessor

Thanks acrobat, I must have only selected debug when setting the preprocessor definitions.