Error with setGlobalFont()

Started by Jliu11, 30 January 2016, 08:59:35

Jliu11

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

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?

Jliu11

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

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.

Jliu11