Help me Codeblock

Started by santi, 21 August 2020, 02:49:43


I need help to install Tgui in Codeblock, it can be step by step, or images, I am newbie in this, thank you very much.
Windows 10x64
Codeblock 20
mingw32 8.1


Since you use mingw 8.1 you will first have to compile TGUI with CMake (and SFML as well). Have a look at
Feel free to ask if you get stuck at some step.


Hello Thank you, it cost me but I made it, everything perfect until I reached "In “Linker settings” under “Other linker options” add ‘-ltgui’ in the ‘Release’ settings and/or add ‘-ltgui-d’ in the ‘Debug’ settings. When linking statically, you have to use ‘-ltgui-s’ and ‘-ltgui-s-d’ instead of course. Also note that the order has to be correct: first tgui, then the libraries from sfml.", your tutoriasl,could you please explain that part better to me, Thank you


You can build your program with 2 settings: Debug or Release. In the screenshot ( you will see those on the left side. If you click on the project name then it shows settings that are shared between the options, if you click on Release or Debug then the rest of the window you show settings specific to either Release or Debug. Usually you will always want to use Debug while developing and only build a Release version when you want to run the program on someone elses computer.

In CMake you set an option CMAKE_BUILD_TYPE. Was it set to Debug or Release? When your project is in Release mode (which you can change somewhere in a combo box at the top of codeblocks) then you must use libraries with Release as build type. Similarly in a project that uses Debug, you must use Debug libraries.

The tgui library that you build has a different name depending on what CMAKE_BUILD_TYPE and TGUI_SHARED_LIBS were set to in CMake.
- libtgui-s.a if CMAKE_BUILD_TYPE=Release and TGUI_SHARED_LIBS=FALSE
- libtgui-s-d.a if CMAKE_BUILD_TYPE=Debug and TGUI_SHARED_LIBS=FALSE

The linker settings from the screenshot should already contain sfml-system, sfml-window and sfml-graphics. Adding TGUI is identical to what you should already have there. You just have to add tgui on top of that list (not at the bottom).

- If you build dynamic TGUI libraries (TGUI_SHARED_LIBS was set to TRUE in cmake) and will include tgui.dll next to your exe:
On the left side of the window, if Release is selected, under "Other linker options" you need to add "-ltgui" (without the quotes).
If Debug is selected, you need to add "-ltgui-d".

- If you build static TGUI libraries (TGUI_SHARED_LIBS was set to FALSE in cmake) and have SFML_STATIC defined in your project:
If Release is selected, you need to add "-ltgui-s".
If Debug is selected, you need to add "-ltgui-s-d".

If you followed the tuturial step by step then you will have only build one TGUI library (either Debug or Release), so only one configuration will work in CodeBlocks. If you want to be able to build both Debug and Release versions of your program then you just need to follow the "CMake" and "Building the library" steps from the tutorial a second time, but this time with CMAKE_BUILD_TYPE changed to the other option.


Hello, can't
Compile CMAKE...OK
A guide on "youtube" or pict step by steep ,would be useful, more practical
could you create one? I would be very grateful, thanks


Creating a video is too much work, plus I wouldn't be able to describe it any better than the screenshot and my post already do.

The steps to install a library are practically the same for any library. How did you install SFML? Just follow any SFML tutorial and instead of having "sfml-system", "sfml-window" and "sfml-graphics" components you just have a single component called "tgui". Everything else is identical.

In case it helps, someone created a codeblocks template for TGUI that will set the settings for you. But it might be just as difficult to use if you don't understand what you are doing.
Quoteheres a codeblocks template i made to save myself some time. it just links all the sfml libraries and tgui. it assumes you have your libraries in C:\CppLibraries\TGUI\lib and headers in C:\CppLibraries\TGUI\include. For the SFML libraries and headers, just replace TGUI with SFML, or you can just change the .cbp file to whatever your directories are. unzip it and chuck the folder in%APPDATA%\CodeBlocks\UserTemplates. it also includes the basic sfml example from the sfml website.


Thanks, I'm going to uninstall Codeblock and install everything again. Weird that SFML, SFGUI and SQLLite work perfectly, and TGUI Problem, we must insist, thanks.


What exactly is the problem? What isn't working? Are you getting error messages?


It isn't corrupted for me.

But you can ignore the template and just configure it the normal way. What exactly are you stuck on? Why would you decide to reinstall codeblocks? You say that all those libs work but not TGUI, then what doesn't work exactly?

Edit: forget the template. I never looked at it before, I just opened it for the first time and it doesn't contain what I expected. It's not very usable.