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

Author Topic: Help with VS 2017 setup  (Read 5038 times)

0 Members and 1 Guest are viewing this topic.

Ignis

  • Newbie
  • *
  • Posts: 5
    • View Profile
Help with VS 2017 setup
« 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Help with VS 2017 setup
« Reply #1 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:
  • Get the SFML source code either from GitHub or from the download page
  • Make sure the latest version of CMake is installed, install it otherwise
  • Run the CMake GUI, set the source and build dir paths and pick the VS 2017 generator
  • Choose the options you want in CMake - they're all explain in our official CMake tutorial (I especially recommend to set the CMAKE_INSTALL_PREFIX to a directory that is writable.)
  • Click on "Generate" and let CMake create project files
  • Open the INSTALL project file in VS 2017
  • Build the INSTALL project
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Ignis

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Help with VS 2017 setup
« Reply #2 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.
« Last Edit: May 13, 2017, 03:37:33 pm by Ignis »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Help with VS 2017 setup
« Reply #3 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Ignis

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Help with VS 2017 setup
« Reply #4 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:
  • Created a folder (SFML) with 2 subfolder (include and lib);
  • In the former I put all the files present in the include folder from the source code;
  • In the latter I put all the files from the lib folder generated by CMake, both debug and release files, merging them together;
  • I moved the SFML folder to my project folder (the external one with the .sln file);
  • I linked all libraries and headers following the official tutorial, but using the $(SolutionDir) command to make it portable;
  • I compiled a test program with the #include 'SFML/Graphics'.
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?
« Last Edit: May 14, 2017, 04:15:58 pm by Ignis »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Help with VS 2017 setup
« Reply #5 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).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Ignis

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Help with VS 2017 setup
« Reply #6 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.
« Last Edit: May 14, 2017, 04:35:34 pm by Ignis »

Ignis

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Help with VS 2017 setup
« Reply #7 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.
« Last Edit: May 15, 2017, 05:13:24 pm by Ignis »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Help with VS 2017 setup
« Reply #8 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".
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything