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

Author Topic: Linking SFML 2.0 to MS Visual Studio 2012  (Read 9831 times)

0 Members and 1 Guest are viewing this topic.

massive_potato

  • Newbie
  • *
  • Posts: 37
    • View Profile
Linking SFML 2.0 to MS Visual Studio 2012
« on: August 15, 2012, 06:43:24 am »
I recently downloaded the latest version of Microsoft Visual Studio (MS Visual Studio Ultimate RC), but can't seem to link it to SFML. Is there anything different that needs to be done from the older versions of MS Visual Studio, or is the process the same? Are there any extra steps that need to be taken in order to link SFML to MS Visual Studio 2012?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Linking SFML 2.0 to MS Visual Studio 2012
« Reply #1 on: August 15, 2012, 08:52:51 am »
Afaik VS12 isn't supportet yet, but there's somewhere a setting to revert to VS10. Using the forum's search function you can find similar questions, where someone suggested that solution. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

massive_potato

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Linking SFML 2.0 to MS Visual Studio 2012
« Reply #2 on: August 15, 2012, 05:22:44 pm »
I guess I didn't look through the forums enough  :-\ Thanks for the suggestion!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking SFML 2.0 to MS Visual Studio 2012
« Reply #3 on: August 15, 2012, 05:36:23 pm »
Before doing that, what was your problem? It's supposed to be runtime problem, not a linker issue.
Laurent Gomila - SFML developer

lrx

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Linking SFML 2.0 to MS Visual Studio 2012
« Reply #4 on: August 15, 2012, 07:12:56 pm »
I am using VS2012 for a while now, and am very pleased with it. There are no additional steps you have to take in order to use it. It it exactly the same as VS2010, although you will have to build libs yourself, fortunatly CMake already supports least VS. Remember to put all libs and includes in relatively simple directory, w/o "-,.'" spaces and such, that makes it easier to spot any error there.

There is one Major change you need to keep in mind when using VS11. All dlls have to be put to your executable directory. example: for Project named  "Proj"

put according dlls into "Proj/Debug" and "Proj/Release".
All resources like fonts and images goes into "Proj/Proj" folder (the one where source code is)

It is a bit strange but that's how its done now. And it makes sense, you separate release and debug dlls by default now :)

Hope that helps :)


massive_potato

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Linking SFML 2.0 to MS Visual Studio 2012
« Reply #5 on: August 15, 2012, 11:53:42 pm »
Laurent - perhaps I worded my issue a bit poorly. Each time I tried to utilize an SFML object, Visual Studio threw a stack corruption error at me. I figured it was an error on my part when I linked SFML to my project.

EDIT: I've narrowed it down to trying to use a vertex array. Without it, everything seems to work as expected. When I use it, however, stack corruption errors are thrown.
« Last Edit: August 16, 2012, 12:02:30 am by massive_potato »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking SFML 2.0 to MS Visual Studio 2012
« Reply #6 on: August 16, 2012, 08:02:21 am »
Can you show the relevant code?
Laurent Gomila - SFML developer

kornfan

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Re: Linking SFML 2.0 to MS Visual Studio 2012
« Reply #7 on: November 26, 2012, 02:00:20 am »
I've got the same problem, although I didn't compile libs as @lrk advised.

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

Code from the tutorials, and it does generate



No build errors, no linker problems, just that. Can I rely on that environment or should I rather change to the VS2010?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking SFML 2.0 to MS Visual Studio 2012
« Reply #8 on: November 26, 2012, 07:54:39 am »
Quote
I've got the same problem, although I didn't compile libs as @lrk advised.
If you download SFML for VC++ XXX and use it with VC++ YYY, it's not going to work. Every single version of VC++ breaks binary compatibility with previous versions.

So if we always answer "you must recompile SFML", it's not just to bother people ;)
Laurent Gomila - SFML developer

 

anything