Skip to main content
GameDev.net gamedev.net
🔒 Locked

Setting up SFML with visual studios

Started by itachii Nov 21, 2018 at 8:43 PM 13 replies 5.2k views
Original Post
itachii
itachii

i am having a really hard time setting up sfml with visual studios and have try a number of sources already and was wondering if somebody could help me out

itachii
Rutin
Rutin
1 hour ago, itachii said:

i am having a really hard time setting up sfml with visual studios and have try a number of sources already and was wondering if somebody could help me out

What have you tried that differs from the official guide: https://www.sfml-dev.org/tutorials/2.5/start-vc.php, and what problem are you having?

Programmer and 3D Artist
itachii
itachii

sorry it took me so long to respond i just go frustrated and left my laptop alone for a minute.

but this is my problem i set up everything right and followed all the directions on the website but i think the problem is that i did extract the right file to the right place.

Capture.PNG

Capture(2).png

itachii
Rutin
Rutin

In your project go to:

image.png.fe8ff3b4552f097584d8e2cd2b1c70fd.png

Click on where I have the circle under DEBUG MODE - then click EDIT.

Then paste the proper lib references under Additional Dependencies:

sfml-graphics-s-d.lib
sfml-window-s-d.lib
sfml-system-s-d.lib
sfml-main-d.lib
freetype.lib
opengl32.lib
winmm.lib
sfml-audio-s-d.lib
openal32.lib
flac.lib
vorbisenc.lib
vorbisfile.lib
vorbis.lib
ogg.lib

image.png.a697f80ba401e5e6571f4b1cbc70676c.png

Do the same for RELEASE mode:

sfml-graphics-s.lib
sfml-window-s.lib
sfml-system-s.lib
sfml-main.lib
freetype.lib
opengl32.lib
winmm.lib
sfml-audio-s.lib
openal32.lib
flac.lib
vorbisenc.lib
vorbisfile.lib
vorbis.lib
ogg.lib

Then you can link statically:

image.png.936356c824255c53829159c19dcaada3.pngWith All Configurations selected, add: SFML_STATIC

If you don't want static linking then don't add SFML_STATIC, but keep in mind you'll need to include the .dll files with your EXE, and don't reference any of the lib files with "s", example: sfml-graphics-s-d.lib - use: sfml-graphics-d.lib (just remove the -s

For Debug:

sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib
sfml-main-d.lib
freetype.lib
opengl32.lib
winmm.lib
sfml-audio-d.lib
openal32.lib
flac.lib
vorbisenc.lib
vorbisfile.lib
vorbis.lib
ogg.lib


For Release:

sfml-graphics.lib
sfml-window.lib
sfml-system.lib
sfml-main.lib
freetype.lib
opengl32.lib
winmm.lib
sfml-audio.lib
openal32.lib
flac.lib
vorbisenc.lib
vorbisfile.lib
vorbis.lib
ogg.lib

The above will also depend on what you're including, so use the guide as reference on the SFML site.

Let me know if this works.

Programmer and 3D Artist
itachii
itachii

this happen when i try static linking

Capture(3).PNG

itachii
Rutin
Rutin
3 minutes ago, itachii said:

this happen when i try static linking

Capture(3).PNG

This will only happen if you have the wrong "sfml-graphics-s-d.lib" and "sfml-graphics-s.lib" listed.

Please copy and paste your list for both DEBUG and RELEASE so I can see what you have.

Also if you run in DEBUG mode do you have the same issue?

Programmer and 3D Artist
itachii
itachii

yes the same thing happens on both

and thank you for helping me so far i really appreciate it

Capture(4).PNG

itachii
itachii
itachii

visual studio 15/17 and 32 bit

Capture(5).PNG

Capture(6).PNG

itachii
Rutin
Rutin

Are you able to send me your project file?

(You can PM me the download link)

Programmer and 3D Artist
Rutin
Rutin

The problem is this, you've mixed up Linker->Input and C/C++ Preprocessor.

image.png.00a6719f11ca099c8e15af39ba37d22b.png

image.png.22f73cc649a68503332ba8bdd13253f8.png

This needs to be like my screen shot:

image.png.936356c824255c53829159c19dcaada3.png

Remove ONLY SFML_STATIC from Linker->Input FOR ALL CONFIGS

Then under C/C++ add it like above under All Configs.

Should fix your issue!

Programmer and 3D Artist
itachii
itachii

THANK YOU SO MUCH

thank you.PNG

itachii
JWColeman
JWColeman

So, first I added the executable directories:


image.png.69fee85e597943a15d52eae9dce6aebb.png

Then, the library Directories:

image.png.2970a5471fe8b49fa9ad34e85dea212c.png

Then, I added my Extra Includes:

image.png.8baa9298b60af3660209d0f94bd161ed.png

Then, added additional library directories:
image.png.15c66cf420e66106e11cb5696ee950a9.png

Note, the SFML folder must actually be in this location....


Then, I added my dependencies:

image.png.def68f79d9658478effba1bfdf1756bb.png

Note: -d for debug, and regular old sfml-audio.lib for release.


Done, I think? It was very recently I did this and I hated the process tbh.



Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.