*

Max

  • *
  • 4
    • View Profile
Access violation in gui.draw()
« on: 26 June 2014, 11:30:23 »
I have a simple code, but it throws an exception in gui.draw()
Code: [Select]
#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

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Access violation in gui.draw()
« Reply #1 on: 26 June 2014, 11:32:43 »
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

  • *
  • 4
    • View Profile
Re: Access violation in gui.draw()
« Reply #2 on: 26 June 2014, 11:44:03 »
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

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Access violation in gui.draw()
« Reply #3 on: 26 June 2014, 11:45:47 »
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

  • *
  • 4
    • View Profile
Re: Access violation in gui.draw()
« Reply #4 on: 26 June 2014, 11:49:15 »
Ouch! Thanks, I'll try

*

Max

  • *
  • 4
    • View Profile
Re: Access violation in gui.draw()
« Reply #5 on: 26 June 2014, 12:05:26 »
Well, was able to run with dynamic linking, but I can not statistically

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Access violation in gui.draw()
« Reply #6 on: 26 June 2014, 12:19:05 »
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.