Consistant Error
« on: 25 June 2014, 02:44:05 »
I have been getting this error for a while now.

Unhandled exception at 0x5FCAD0EA (sfml-graphics-d-2.dll) in TGUI Tutorial Two.exe: 0xC0000005: Access violation writing location 0xFEEEFF2A.


Code: [Select]
#include <SFML\Graphics.hpp>
#include <TGUI\TGUI.hpp>
#include <iostream>

using std::cout;
using std::endl;

int main()
{
const int Width = 800;
const int Height = 600;
sf::RenderWindow Window;
Window.create(sf::VideoMode(Width, Height), "TGUI Panel");

sf::Font font;
if(!font.loadFromFile("arial.ttf"))
cout << "Error! Could not a font" << endl;

tgui::Gui gui(Window);
gui.setGlobalFont(font);

while(Window.isOpen())
{
Window.clear();
sf::Event Event;

while(Window.pollEvent(Event))
{
switch(Event.type)
{
case sf::Event::Closed:
Window.close();

case sf::Event::KeyPressed:
if(Event.key.code == sf::Keyboard::Escape)
Window.close();
break;

}
gui.handleEvent(Event);
}


gui.draw();
Window.display();
}


return EXIT_SUCCESS;
}

I usually have a problem at the return EXIT_SUCCESS line according to my debugger.
Any Help Would be appreciated.

Additional information:
I have

Visual Studio Express 2012 For Desktop
TGUI 0-6-1
SFML 2.1

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Consistant Error
« Reply #1 on: 25 June 2014, 08:15:58 »
It looks like a configuration mistake.

Did you download a precompiled libary? They also contain sfml libs which you must use with them.

Otherwise just make sure you are using the release libs in release mode and the debug libs in debug mode.

Re: Consistant Error
« Reply #2 on: 26 June 2014, 01:44:31 »
@texus, thanks for answering.

Yes, I did download the precomplied version. I am using the SFML and TGUI libs and placing them into the Debug folder.

Here is my configuration in properties:
All Configuration:
C/C++:
   Additional Include Directories: C:\SFML-2.1\include; C:\TGUI-0.6.1\include

Linker:
   Additional Library Directories: C:\SFML-2.1\lib; C:\TGUI-0.6.1\lib\TGUI; C:\TGUI-0.6.1\lib\SFML

Active Debug:

Linker:
Input:
Additional Dependencies: sfml-graphics-d.lib; sfml-system-d.lib; sfml-window-d.lib; sfml-audio-d.lib; tgui-d.lib;

Still having the same problem.
Thanks for your patience.
« Last Edit: 26 June 2014, 01:50:31 by Czar05 »

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Consistant Error
« Reply #3 on: 26 June 2014, 10:19:42 »
Quote
Additional Library Directories: C:\SFML-2.1\lib; C:\TGUI-0.6.1\lib\TGUI; C:\TGUI-0.6.1\lib\SFML
I think you should try to remove "C:\SFML-2.1\lib" from that list. It probably first finds sfml 2.1 before the sfml version shipped with tgui.

Quote
C:\SFML-2.1\include
You should remove this  too. Although these files are probably still the same, you should take the ones that ship with tgui.

Like it says in the tutorial:
Quote

On windows libraries simply aren't compatible between different versions, so you have to use the exact same sfml version in your project that I used to compile tgui. If you want to use a different version, then you should compile tgui yourself.

Once sfml 2.2 comes out, I won't have to ship a custom sfml version anymore. But since 2.1 has a bug in it that influences tgui, I am forced to do it this way.
« Last Edit: 26 June 2014, 10:21:30 by texus »

Re: Consistant Error
« Reply #4 on: 26 June 2014, 21:31:54 »
Thanks texus! Got it working. I didn't know the SFML lib's and TGUI were not compatible. Learned something new today.