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

Author Topic: Release/Link issues with VS10 & SFML2.0 [SOLVED]  (Read 1455 times)

0 Members and 1 Guest are viewing this topic.

sircuddles

  • Newbie
  • *
  • Posts: 10
    • View Profile
Release/Link issues with VS10 & SFML2.0 [SOLVED]
« on: January 26, 2013, 08:34:07 am »
So I've made a basic application using SFML 2.0.  I'd like to be able to release it as a single .exe to use on other computers, for example, but when running it on my wife's PC I get 'You don't have sfml-graphics.dll' type errors (as she obviously doesn't have SFML installed).

Until now I have been using -d.lib's and everything has been fine.  The release version runs properly on my PC.  I'm a pretty huge noob, so even getting the release version to run properly without the console window caused some grief.  I had to change the SubSystem and Entry point... or something (this was all done blindly via Google, have no clue what I really did).  I only mention that in case it's causing issues, although it's probably not.

I tried using sfml-graphics-s.lib, but it doesn't even compile.  Not sure if that was for 1.6 only or I've done something wrong somewhere.  I know I have to link the .lib's properly somewhere, but I'm lost on how to do it.  Any help is appreciated.
« Last Edit: January 26, 2013, 11:39:48 am by sircuddles »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10916
    • View Profile
    • development blog
    • Email
AW: Release/Link issues with VS10 & SFML2.0
« Reply #1 on: January 26, 2013, 09:32:14 am »
Maybe this post can give q bit more insight into the whole building proccess.

The get rid of the console window you have to link against sfml-main(-d) and change the subsystem to window.

To statically link SFML you've to link the -s libs and define SFML_STATIC in the preproccessor settings.

I think both points are explained in the tutorial and you can even get some more info in the FAQ on the GitHub wiki. ;)

Note: If you're using audio, you still have to provide openal32.dll and libsndfile.dll. Besides it's not a bad thing to use DLLs, you just need to create a directory and copy the exe with the dlls and the resources in there. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

sircuddles

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Release/Link issues with VS10 & SFML2.0
« Reply #2 on: January 26, 2013, 11:39:29 am »
Reading that thread and doing some more Googling didn't get me any further, although it was a good lesson.  Doesn't surprise me, because this kind of thing is far out of the scope of what I'm familiar with (I'm still learning lists, inheritance, etc) so I mostly just fumble around until a solution arises.

To anyone reading this thread in the future, I eventually found my way to Solution Properties > C/C++ > Preprocessor > Preprocessor Definitions and added the line SFML_STATIC.  Recompiled, and it works on other PCs. 

Thanks :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10916
    • View Profile
    • development blog
    • Email
Re: Release/Link issues with VS10 & SFML2.0 [SOLVED]
« Reply #3 on: January 26, 2013, 12:58:40 pm »
Reading the official tutorial would've been enough...

Quote from: Tutorial
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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/