tugi 0.7 mingw tdm 5 not building

Started by WiWo, 13 September 2017, 15:50:43

WiWo

I'm trying to use tgui 0.7 with CodeLite on Windows 10. I installed the TDM-GCC compiler (5.1) (32-bit).
I can successfully use CMake(32-bit) to create a CodeLite project. However, when I try to build it using CodeLite I get this error:

<tgui path>\src\TGUI\Loading\Theme.cpp: In member function 'virtual void tgui::Theme::initWidget(tgui::Widget*, std::__cxx11::string, std::__cxx11::string)':
<tgui path>\src\TGUI\Loading\Theme.cpp:364:66: error: '_fullpath' was not declared in this scope
             buffer = _fullpath(nullptr, resourcePath.c_str(), 512);
                                                                                       ^
src\TGUI\CMakeFiles\tgui.dir\build.make:562: recipe for target 'src/TGUI/CMakeFiles/tgui.dir/Loading/Theme.cpp.obj' failed
mingw32-make.exe[1]: *** [src/TGUI/CMakeFiles/tgui.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2

The same issue appeared when I tried the 0.8 version of tgui.

When instead I try to use the precompiled version of tgui 0.7 for tdm I get errors where I use themes (for instance when calling theme->load), and also in the Singnals.hpp file.

What I'm trying to do is simply compile a tgui 0.7 project on windows 10, but since VS 2017 Community has no tutorial and CodeBlocks keeps having problems with c++11, CodeLite was the best solution.

Thanks for any help.

texus

I would expect the _fullpath function to exist in MinGW, otherwise I would have had errors when building for TDM-GCC 4.9 and MinGW-w64 6.1. If TDM-GCC 5.1 does not has the function then it will be difficult to determine whether I need to use the _fullpath or realpath function.
If all MinGW versions have an implementation for realpath then it might become easier. Could you check if it compiles when you replace the "#ifdef SFML_SYSTEM_WINDOWS" above the _fullpath call to "#ifded _MSC_VER"?

If you use the precompiled version then the MinGW version must match exactly with the prebuild one. But could you tell me which errors you were getting exactly?

The Visual Studio tutorial should be independent of the VS version. There are no VS2017 precompiled downloads because there are none for SFML yet. I have everything ready to build them, but I can't do so until SFML releases official VS2017 binaries in their download page. The VS2015 and VS2017 binaries should however be compatible, it should be possible to use VS2017 when downloading both the VS2015 binaries from SFML and TGUI, although I haven't tested that.

WiWo

When I use the precompiled version I get a load of "undefined reference" errors. Here are the one I get (after getting rid of any theme in my code):

c:/TGUI-0.7done/include/TGUI/Signal.hpp:356: undefined reference to `_imp___ZN4tgui16SignalWidgetBase18extractSignalNamesENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
c:/TGUI-0.7done/include/TGUI/Signal.hpp:362: undefined reference to `_imp___ZN4tgui7toLowerENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
c:/TGUI-0.7done/include/TGUI/Signal.hpp:365: undefined reference to `_imp___ZN4tgui7toLowerENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
c:/TGUI-0.7done/include/TGUI/Signal.hpp:374: undefined reference to `_imp___ZN4tgui7toLowerENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
c:/TGUI-0.7done/include/TGUI/Signal.hpp:356: undefined reference to `_imp___ZN4tgui16SignalWidgetBase18extractSignalNamesENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
c:/TGUI-0.7done/include/TGUI/Signal.hpp:362: undefined reference to `_imp___ZN4tgui7toLowerENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
c:/TGUI-0.7done/include/TGUI/Signal.hpp:365: undefined reference to `_imp___ZN4tgui7toLowerENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
c:/TGUI-0.7done/include/TGUI/Signal.hpp:374: undefined reference to `_imp___ZN4tgui7toLowerENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'

When using #ifdef _MSC_VER in Theme.cpp I get this error instead:

<tgui path>\src\TGUI\Loading\Theme.cpp: In member function 'virtual void tgui::Theme::initWidget(tgui::Widget*, std::__cxx11::string, std::__cxx11::string)':
<tgui path>\src\TGUI\Loading\Theme.cpp:369:60: error: 'realpath' was not declared in this scope
             buffer = realpath(resourcePath.c_str(), nullptr);
                                                                                ^

Thanks for your help.

texus

These undefined reference errors are just because the MinGW versions of the library and your compiler doesn't match, so that it not a bug in tgui. I though you meant you got compile errors.

So you have a compiler that neither has _fullpath nor realpath, I'm not sure what I can do about that. Could you send a link of where you downloaded the compiler exactly, so that I can have a look at the specific version you have?

texus

Apparently the _fullpath function is only declared when passing -std=gnu++11 instead of -std=c++11 in your compiler. I have updated the 0.7 branch (https://github.com/texus/TGUI/tree/0.7), I will update the 0.8-dev code as well after checking that 0.7 still builds correctly on all compilers.

WiWo

I apology that took me so long to reply. I was trying to use another compiler (MinGW 6.10), but it didn't work.

I built the new libraries using TDM-GCC 5.1 and now everything works.

Thank you really much for your help.