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

Author Topic: Problems using SFML with Visual Studio 2015 Enterprise (Solved)  (Read 11826 times)

0 Members and 1 Guest are viewing this topic.

Niely

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #15 on: September 13, 2015, 07:44:23 pm »
I tried them now, and none is working. I just want to know how to use SFML with Visual Studio. How do I build SFML and add it to Visual Studio then?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #16 on: September 13, 2015, 08:37:22 pm »
Don't just try randomly, read the tutorials carefully.

If you're not familiar with CMake and make tools, either read their CLI documentation or use the graphical application CMake-GUI.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Niely

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #17 on: September 13, 2015, 09:04:46 pm »
I have read the tutorial carefully three times, but I just don't understand it.

My last two questions are:
1) What to build now?
2) How to use with VS then?

If I'd understand the tutorial, I wouldn't need to ask it on the forum here.

Niely

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #18 on: September 16, 2015, 07:12:58 pm »
What do I need to build now?

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #19 on: September 16, 2015, 09:30:15 pm »
Since the VS2015 binaries aren't in the master branch yet, you'll need one extra step, but it's still pretty easy to do:

  • Download and install CMake.
  • Download and install Git.
  • Create a folder where you want to keep SFML's source and build it (this is not the final location for SFML).
  • Open a Command Prompt and go to the folder you just created (or create it now).
  • Run git clone https://github.com/SFML/SFML.git . (note the trailing period). This will download everything else you need to build SFML (sources, dependencies).
  • Switch to the feature branch: git checkout feature/VS2015
  • Create the actual solution and project files by running cmake -DCMAKE_INSTALL_PREFIX=C:/SFML . (provide the path to where you want to put the actual SDK files).
  • Find the created "SFML" solution, open it, and build the "INSTALL" project under "CMake" once for every configuration you need (usually Debug and Release).
« Last Edit: September 16, 2015, 09:32:03 pm by Mario »

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10936
    • View Profile
    • development blog
    • Email
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #21 on: September 17, 2015, 11:39:03 am »
We've just added official binaries: http://www.sfml-dev.org/download/sfml/2.3.2/

However if you want to build from source, you'll still have to use the feature/VS2015 branch.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Niely

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #22 on: September 18, 2015, 09:03:09 pm »
Thanks a lot for the help all!
And a big thanks to the SFML developing team for adding support for VS2015! I'll donate once for sure! :)

But I still had some errors, I first had 76 errors, but now only have 6 left due some option changes.

These are the errors:
Quote
Severity   Code   Description   Project   File   Line
Error   LNK2019   unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main   ConsoleApplication4   c:\Users\Niel\documents\visual studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\ConsoleApplication4.obj   1
Error   LNK2019   unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::close(void)" (__imp_?close@Window@sf@@QAEXXZ) referenced in function _main   ConsoleApplication4   c:\Users\Niel\documents\visual studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\ConsoleApplication4.obj   1
Error   LNK2019   unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ) referenced in function _main   ConsoleApplication4   c:\Users\Niel\documents\visual studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\ConsoleApplication4.obj   1
Error   LNK2019   unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main   ConsoleApplication4   c:\Users\Niel\documents\visual studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\ConsoleApplication4.obj   1
Error   LNK2019   unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) referenced in function _main   ConsoleApplication4   c:\Users\Niel\documents\visual studio 2015\Projects\ConsoleApplication4\ConsoleApplication4\ConsoleApplication4.obj   1
Error   LNK1120   5 unresolved externals   ConsoleApplication4   c:\users\niel\documents\visual studio 2015\Projects\ConsoleApplication4\Debug\ConsoleApplication4.exe   1


I'm just dynamically linking.
I've used the exact same settings as showed on this page:
http://www.sfml-dev.org/tutorials/2.3/start-vc.php


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10936
    • View Profile
    • development blog
    • Email
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #23 on: September 18, 2015, 09:10:07 pm »
Make sure to do a clean rebuild.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #24 on: September 18, 2015, 09:12:34 pm »
Remember this: "unresolved external symbol" means "you mentioned a symbol but didn't tell the linker where to find it".
So either you simply wrote something completely bogus, or you forgot to link the library containing the symbol you referenced or you linked the libraries in the wrong order (yes, link order matters (depending on platform/linker)).
« Last Edit: September 18, 2015, 09:16:31 pm by Jesper Juhl »

Niely

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #25 on: September 18, 2015, 09:23:35 pm »
Did:
Build >> Clean ConsoleApplication && Clean Solution, then rebuild it (what again is clean).
Still getting the same errors.

This is an image of all my configurations:

Imgur: http://imgur.com/OqQSyFW
« Last Edit: September 18, 2015, 09:27:56 pm by Niely »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #26 on: September 18, 2015, 09:31:23 pm »
Did:
Build >> Clean ConsoleApplication && Clean Solution, then rebuild it (what again is clean).
"Clean" is usually a build target in most IDE's (and scons, makefile, whatnot solutions) that will delete all artifacts and start the preprocess/compile/assemble/link process from scratch.

Still getting the same errors.
This is an image of all my configurations:
Would be much simpler if you just quoted the actual command-lines the compiler and linker were invoked with.  Having to look through a bunch of images of a gui just adds noise and makes it difficult for people to deduce the end result.  Just quote the actual invocations - that's simpler.

Niely

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #27 on: September 18, 2015, 09:53:49 pm »
Is there a way to view that CLI output directly in the IDE? So I don't have to work with the cl.exe file? And probably run to 50 other problems using the parameters for that executable?

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #28 on: September 18, 2015, 10:01:38 pm »
I don't use the VS IDE myself, so I don't know directly. But I know it's possible because colleagues quote me that info when their VS builds fail.
This looks like it may be relevant: https://msdn.microsoft.com/en-us/library/f35ctcxw.aspx
Anyway, did you see my previous post: http://en.sfml-dev.org/forums/index.php?topic=18966.msg137019#msg137019 ?

Niely

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: Problems using SFML with Visual Studio 2015 Enterprise
« Reply #29 on: September 18, 2015, 10:05:17 pm »
Solved!

Thanks for the help and patience with me all! I just forgot to also include the window(-d).lib.
Cod runs fine now.