A First SFML 2.0 Project in Visual Studio [dpctd]

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
1,748
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on May 22, 2011

In this video I show you how to make a first project file in Visual Studio or Visual C++ Express which uses SFML 2.0.

The main focus of the lesson is setting up the search directories for the compiler and linker, and linking the actual SFML 2.0 libraries:
sfml-graphics[-s][-d].lib
sfml-audio[-s][-d].lib
sfml-window[-s][-d].lib
sfml-system[-s][-d].lib
sfml-network[-s][-d].lib
where the optional -s is for static and the optional -d is for debug.

Note that when linking with the static libraries, one must define the global compiler macro SFML_STATIC.

Note also that when linking dynamically, one must put the corresponding dynamic libraries in the project directory:
sfml-graphics[-d]-2.dll
sfml-audio[-d]-2.dll
sfml-window[-d]-2.dll
sfml-system[-d]-2.dll
sfml-network[-d]-2.dll

Be aware that (of course!) you need not link static/import libraries or provide dynamic libraries corresponding to modules your are not using.

We compile some test code which you may find here: http://ideone.com/PXw13

Finally, we see how to prevent our SFML application having a console window as well as the GUI window, and we consider additional DLLs needed by SFML.

Notes:
(Thanks for tr1kker for pointing this out)
You must link the C runtime to your library in the same way it was linked to the SFML binaries. I have run out of space in this area, so see the comments section for details on how to change the C runtime used by your project.

Relevant links:
SFML: http://sfml-dev.org
Visual C++ Express: http://www.microsoft.com/express/Downloads/#2010-Visual-CPP
SFML Coder: http://sfmlcoder.wordpress.com/

See also:
Textual 'Building SFML 2.0' Tutorial:
http://sfmlcoder.wordpress.com/2011/05/11/building-sfml-2-0/
Textual 'First Project' Tutorial:
http://sfmlcoder.wordpress.com/2011/05/18/creating-a-first-sfml-project/
Building SFML 2.0 in Visual Studio:
http://www.youtube.com/watch?v=fMNlUfvWOwA

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (SFMLCoder)

  • Hi, I did everything you've said to do. I got all the Binaries for SFML2. set the linker and all that as you described in your video and i get this:

    error C2039: 'IsOpened' : is not a member of 'sf::RenderWindow'

    VERY good tutorial by the way.

  • @FacePalmCPP Yes. IsOpened() has been renamed IsOpen(). I'll update the video eventually, I just haven't had the chance yet...

    And thanks!

  • i put the dll´s in the debug folder of my project. now it works.

  • @kaleight1 Great. I'm pretty sure it should also work to put them in the main project directory, provided you are running the program from within the IDE.

  • @SFMLCoder yes that works too

  • @kaleight1 Good. Is that not what the video says? If not, I'd better add a note in the video information section, at least until I have to chance to update the video itself.

see all

All Comments (31)

Sign In or Sign Up now to post a comment!
  • Thank you Sir, you explain it very clearly.

  • amazing tutorial, i'm looking forward for more.

    great job!

  • Thanks man, your videos are really helpful.

  • Thank you so much for your videos -- I had such trouble finding a good tutorial for getting started with SFML, and you have come through brilliantly! <3

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more