Error with setGlobalFont()
« on: 30 January 2016, 08:59:35 »
I am new to TGUI and just tested the sample code on the link https://tgui.eu/example-code/v0.6/loading-from-file/

But the complier throws an unhandled exception when the code runs to line "if (gui.setGlobalFont("../../fonts/DejaVuSans.ttf") == false)". I am using visual studio 2010. I don't know what is the problem.

*

texus

  • *****
  • 1163
    • View Profile
    • Texus's Blog
Re: Error with setGlobalFont()
« Reply #1 on: 30 January 2016, 12:39:42 »
Since neither sfml nor tgui 0.6 uses exceptions, I think there will be something wrong with the libraries you are linking to. Make sure that both sfml and tgui are linked either both dynamically or both statically and that you link to the release libraries in release mode and the debug libraries in debug mode. Making a mistake in one of these settings can cause random crashes like unhandled exceptions.

If you checked these settings again and you are certain that they are right then answer the following questions:
- What sfml version are you using? (not just the version number but also whether you downloaded it from sfml website or compiled yourself)
- What tgui version are you using?
- Could you attach your .vcxproj file?

Re: Error with setGlobalFont()
« Reply #2 on: 30 January 2016, 17:56:26 »
Checked again. Does't work.

TGUI-0.6.10 Visual C++10 (2010) - 32bit          from official website
SFML-2.0-windows-vc10-32bits                         from official website

See attached file.

*

texus

  • *****
  • 1163
    • View Profile
    • Texus's Blog
Re: Error with setGlobalFont()
« Reply #3 on: 30 January 2016, 18:00:14 »
Quote
<AdditionalDependencies>sfml-system-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;tgui.lib;%(AdditionalDependencies)</AdditionalDependencies>
It appears that you are linking to tgui.lib in debug mode instead of tgui-d.lib. So if your project is in debug mode this could go wrong.

Re: Error with setGlobalFont()
« Reply #4 on: 30 January 2016, 18:26:25 »
Works!!!

Thanks!