Basic tgui program causes error to be raised

Started by Popgalop, 19 June 2014, 01:29:00

Popgalop

I have been building a game using SFML in c++ on windows. I have now finished the game and I have been trying to create a GUI using TGUI because it looked simple and easy to use. I have set it up in my VC++ project and compiled a seemingly simple piece of code.

#include <SFML/Window.hpp>
#include <TGUI/TGUI.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
    tgui::Gui gui(window);

    while (window.isOpen())
    {
        sf::Event event;

        while (window.pollEvent(event))
        {
            gui.handleEvent(event);
        }

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

    return 0;
}

The code compiles fine, however immediately when I start the code I get an Unhandled exception at 0x80002610 in Test.exe: 0xC0000005: Access violation executing location 0x80002610.

I was wondering where the access violation could possibly be coming from. Thanks for your help.

texus

Don't you get a call stack pointing to where the unhandled exception occurred?

It might be because of an incompatibility, so make sure you are linking the correct libraries (in debug mode, both sfml and tgui need debug libs, in release they both need release libs, both have to be static or both dynamic).

Did you download v0.6.3 precompiled libraries, or did you compile yourself?
Which Visual Studio version do you have?

Popgalop

I got it to work :), my problem was that I was using incompatible SFML and TGUI versions now everything works as it should.  Thanks for your help.