SFML community forums

Help => General => Topic started by: Ignis on May 13, 2017, 11:27:48 am

Title: Help with VS 2017 setup
Post by: Ignis on May 13, 2017, 11:27:48 am
Hi everyone, this is my situation: I'm an unexperienced newbie who downloaded Visual Studio 2017 and the latest SFML build just to realize they aren't compatible, so I need to build SFML from source. I followed the tutorial on the site, but can't manage to make it work and the same is true for other tutorial I found online (most of them aren't updated). Can someone link a good guide or, even better, help me step by step in the installation process?
Thanks
Title: Re: Help with VS 2017 setup
Post by: eXpl0it3r on May 13, 2017, 02:14:54 pm
The VS 2015 binaries should work with VS 2017 as long as you have the Win 8.1 SDK installed, however I still recommend to rebuild SFML.

The steps involved already really complicated:
Title: Re: Help with VS 2017 setup
Post by: Ignis on May 13, 2017, 03:36:01 pm
Ok, I did all the steps. Don't know why, but the first time I tried (following the official tutorial) I ended up with an error message like "Unable to find X library". This time all worked fine: the only strange thing was that the compiler said me it ignored the install project during the process, but I guess it's fine (?).
Btw, I compiled in debug mode. Do I need to compile in release mode?
Please forgive my ignorance, but at this point I don't know how to use/link libraries to my project. I want SFML files to be in my project directory, since I plan to work only on one project (or a few ones, but anyway HD space isn't an issue) and I need it to be as portable as possible.
Title: Re: Help with VS 2017 setup
Post by: eXpl0it3r on May 13, 2017, 06:53:15 pm
The INSTALL project itself doesn't generate anything, thus it gets ignore ed which is the correct behavior.

Well once you want to create a final build, you should use the optimized release libraries.

SFML is not setup to be included as source files into a project. In theory it can be done, but needs more knowledge on certain configuration details.

Instead just copy the headers and library files to a placr you can easily move around.

Follow the official tutorial on how to setup SFML with VS.
Title: Re: Help with VS 2017 setup
Post by: Ignis on May 14, 2017, 01:43:35 pm
Sorry if I keep harassing you with stupid questions, but I can't figure out how to make it work.
Here's what I did:
Then compiler said it can't find the include files. The same error holds true if I use static directories for libraries and headers instead of the $(SolutionDir)/. Am I missing something?
Title: Re: Help with VS 2017 setup
Post by: eXpl0it3r on May 14, 2017, 03:22:20 pm
#include 'SFML/Graphics' is wrong, unless that was just a inaccurate rephrasing. So it should be #include <SFML/Graphics.hpp>

And make sure you set the 'Additional Include Directories' for the correct project settings (debug if you build in debug mode).
Title: Re: Help with VS 2017 setup
Post by: Ignis on May 14, 2017, 04:00:49 pm
It was indeed an inaccurate rephrasing. I accidentaly mishmashed the proper code and what the compiler told me. Sorry about that  :P
About your second point: I followed the tutorial and it said explicitly to go to C/C++ -> General -> Additional Include Directories and change it to (SFML path)/include for all configurations (debug/release). I didn't even know there are multiple kind of headers files depending on configuration if this is what you are saying and I have no idea how to find them, assumed I have them.
If you are referring to libraries, they are set in the same way under Link -> General -> Additional Library Directories and in a proper way under Link -> Input -> Additional Dependencies, with sfml-X.lib for release and sfml-X-d.lib for debug.

EDIT: Btw I just realized I forgot to copy dlls (the ones in my SFML/lib plus openal32.dll from the source code) into the same directory of my executable (I'm using dynamic libraries). Obviously fixing this mistake didn't solve the problem, since compiler complain about headers, not libraries.
Title: Re: Help with VS 2017 setup
Post by: Ignis on May 15, 2017, 05:10:38 pm
I solved it. It was obviously some stupid stuff. I observed that when I wrote #include <Graphics.hpp> the compiler said it couldn't find the next library (window?). So I checked the directory and found out that I put headers into SFML/include, with no midway SFML folder I had in source code folder. Then it finally worked.

Thanks for your help and patience, I probably didn't deserve them.
One last question: I have multiple (non fatal) error report. The compiler isn't able to find many pdb files (external to SFML) for debug configuration. Here it is:
(click to show/hide)
Are they due to system architecture (32/64 bit)?
For reference, I compiled in 32 bit on 64 bit Windows 7.
Title: Re: Help with VS 2017 setup
Post by: eXpl0it3r on May 15, 2017, 05:13:28 pm
Ah okay ;D

That's normal and nothing to worry about or even care. PDB files are files that contain debug information, if a library has a PDB file, the Visual Studio debugger can step into the library and tell you where it crashed or similar. Most system libraries don't have PDB files, thus the "errors".