Access violation in gui.draw()

Started by Max, 26 June 2014, 11:30:23

Max

I have a simple code, but it throws an exception in gui.draw()

#include <TGUI/TGUI.hpp>

/////////////////////////////////////////////////////////////////////////////////////////////////////

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

    if (gui.setGlobalFont("arial.ttf") == false)
       return 1;

    // Load all the widgets from a file
   if (gui.loadWidgetsFromFile("form.txt") == false)
   return 1;

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

            gui.handleEvent(event);
        }

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

        sf::sleep(sf::milliseconds(1));
    }

    return EXIT_SUCCESS;
}

texus

It is most likely 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).

In case you are sure everything is correct:
- Did you download v0.6.3 precompiled libraries, or did you compile yourself?
- Which compiler are u using?

Max

I downloaded 0.6.3 compiled libraries for Visual Studio 2010.

for debug:
sfml-graphics-s-d.lib
sfml-window-s-d.lib
sfml-system-s-d.lib
tgui-s-d.lib

SFML working individually

texus

Are you using the sfml libraries provided in the tgui download? Because the precompiled tgui libs will only work with that specific sfml version.

Max


Max

Well, was able to run with dynamic linking, but I can not statistically

texus

I still believe that there is something wrong with your setup then.

I can't immediately help, I don't get on windows often anymore, for now you can link dynamically.
If you can't find anything that you did wrong in setting up the static version, then you could perhaps upload your project including the sfml and tgui libraries somewhere (e.g. dropbox). I can then have a look at it, but not today. I do want this solved though, even though the chance is small, if the tgui libs would really be currupted then I need to fix it.