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

Author Topic: I'm having some problems to setup SFML 2.3 on Visual Studio2012.  (Read 2522 times)

0 Members and 2 Guests are viewing this topic.

henriquehcm

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
I'm having some problems to setup SFML 2.3 on Visual Studio2012.
« on: December 08, 2015, 05:24:54 am »
Alright guys, I really didn't wanted to create that thread since you probably have to answer this kinda of question a hundred times per day. But here I go!

Since earlier this year I've been trying to play with SFML, but I was never able to setup it properly. I always get some error or DLL missing. And this wasn't a problem because I just wanted to play with it, but now I really need it for a College Project.

I'm using:
W10 64 bits.


Visual Studio 2012


And I've tried to setup a Visual C++ 12 (2013) - 32-bit SFML 2.3.2 version (because I need to create a win32 project)

I've followed the official tutorial, I've followed a youtube tutorial, I've tried on my on way. Nothing works.

I've tried multiple SFML versions (Visual C++ 12 32bit and Visual C++ 12 64bit, always creating a new project).

I've tried to paste the DLL file in the project's folder. But it still don't work.
Right now i'm trying with Visual C++ 11, and i'm getting these errors:

Code: [Select]
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::close(void)" (__imp_?close@Window@sf@@QAEXXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QAE@EEEE@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Shape::setFillColor(class sf::Color const &)" (__imp_?setFillColor@Shape@sf@@QAEXABVColor@2@@Z) referenced in function _main
1>Source.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>Source.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>Source.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>Source.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>Source.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>Source.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>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::RenderStates const sf::RenderStates::Default" (__imp_?Default@RenderStates@sf@@2V12@B)
1>Source.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Color const sf::Color::Green" (__imp_?Green@Color@sf@@2V12@B)
1>c:\users\henrique\documents\visual studio 2012\Projects\ConsoleApplication1\Debug\ConsoleApplication1.exe : fatal error LNK1120: 17 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I'm trying to run suggested test code in the official website http://www.sfml-dev.org/tutorials/2.3/start-vc.php

Some additional SS:








So, what do I need to do to solve these problems? HOW CAN I SETUP THIS PROPERLY?

Sorry for the long post.

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: I'm having some problems to setup SFML 2.3 on Visual Studio2012.
« Reply #1 on: December 08, 2015, 08:54:13 am »
If you use the static libraries, you have to define SFML_STATIC.

And you link to both the debug and release libraries of sfml...
« Last Edit: December 08, 2015, 10:37:10 am by SpeCter »

SeriousITGuy

  • Full Member
  • ***
  • Posts: 123
  • Still learning...
    • View Profile
Re: I'm having some problems to setup SFML 2.3 on Visual Studio2012.
« Reply #2 on: December 08, 2015, 10:13:49 am »
Read the official tutorial and learn the difference between static and dynamic linking
http://www.sfml-dev.org/tutorials/2.3/start-vc.php

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: I'm having some problems to setup SFML 2.3 on Visual Studio2012.
« Reply #3 on: December 08, 2015, 04:04:20 pm »
I'm using:
...
Visual Studio 2012

Version 11.
You're using version 11 (2012) of Visual Studio so don't use SFML for version 12 (2013).
Note that the version number and year are rarely equal.

So, ignore SFML version 12 and stick to SFML for version 11.

As mentioned above, define SFML_STATIC if you are linking statically otherwise you'll need to link to the libraries without -s in the filename (and include the DLLs in the executable's folder).
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*