Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML + TGUI build problems in Code::Blocks 13.12 + MinGW Compiler (Win7x64)  (Read 7962 times)

0 Members and 1 Guest are viewing this topic.

olfibits

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Hello,

I'm currently starting to work with TGUI and SFML for cross-platform GUI development.
Because TGUI bases on SFML, I downloaded a built version of SFML (SFML 2.2 for Windows/MinGW) and TGUI 0.7 for Windows/MinGW.
Before I start interpreting and estimating some nonsense, I'll post what Code::Blocks showed to me.
(In the linker settings any libraries from TGUI\lib\* and SFML\lib\* are included as well as the SFML and TGUI root directory. I don't think that the problem is there because I can't find an error message like "Fatal error: anyfile.h - No such file or directory".

So, here it goes.

||=== Build: Debug in Olfibits-C++ (compiler: GNU GCC Compiler) ===|
C:\Users\***\Olfibits Software Project\My GUI Test Project\SFML\include\SFML\System\String.hpp|398|error: expected ',' or '...'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\SFML\include\SFML\System\String.hpp|412|error: expected ',' or '...'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Global.hpp||In function 'std::string tgui::to_string(T)':|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Global.hpp|64|error: 'std::string' is not a class member|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Global.hpp|150|error: expected unqualified-id before ')' token|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Global.hpp|157|error: expected unqualified-id before ')' token|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Global.hpp|164|error: expected ',' or '...'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h|804|error: invalid use of '::'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h||In member function 'int std::sub_match<_BiIter>::compare(const std::sub_match<_BiIter>&) const':|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h|822|error: 'std::string' is not a class member|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h|822|error: 'std::string' is not a class member|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h||In member function 'int std::sub_match<_BiIter>::compare(const string_type&) const':|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h|835|error: 'std::string' is not a class member|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h||In member function 'int std::sub_match<_BiIter>::compare(const value_type*) const':|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h|848|error: 'std::string' is not a class member|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h||In function 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::sub_match<_Bi_iter>&)':|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h|1425|error: 'std::string' is not a class member|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\bits\regex.h|1649|error: invalid use of '::'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\main.cpp||In function 'int main(int, char**)':|
C:\Users\***\Olfibits Software Project\My GUI Test Project\main.cpp|136|error: 'to_string' is not a member of 'std'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\main.cpp|136|note: suggested alternative:|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Global.hpp|59|note:   'tgui::to_string'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp||In instantiation of 'unsigned int tgui::SignalWidgetBase::connect(const string&, Func, Args ...) [with Func = main(int, char**)::<lambda()>; Args = {}; std::string = std::basic_string<char>]':|
C:\Users\***\Olfibits Software Project\My GUI Test Project\main.cpp|185|required from here|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp|362|error: cannot pass objects of non-trivially-copyable type 'class std::basic_string<char>' through '...'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp|365|error: cannot pass objects of non-trivially-copyable type 'class std::basic_string<char>' through '...'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp|374|error: cannot pass objects of non-trivially-copyable type 'class std::basic_string<char>' through '...'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp||In instantiation of 'unsigned int tgui::SignalWidgetBase::connect(const string&, Func, Args ...) [with Func = main(int, char**)::<lambda()>; Args = {}; std::string = std::basic_string<char>]':|
C:\Users\***\Olfibits Software Project\My GUI Test Project\main.cpp|239|required from here|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp|362|error: cannot pass objects of non-trivially-copyable type 'class std::basic_string<char>' through '...'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp|365|error: cannot pass objects of non-trivially-copyable type 'class std::basic_string<char>' through '...'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp|374|error: cannot pass objects of non-trivially-copyable type 'class std::basic_string<char>' through '...'|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp|245|error: 'void tgui::Signal::connect(unsigned int, Func, Args ...) [with Func = main(int, char**)::<lambda()>; Args = {}]', declared using local type 'main(int, char**)::<lambda()>', is used but never defined [-fpermissive]|
C:\Users\***\Olfibits Software Project\My GUI Test Project\TGUI\include\TGUI\Signal.hpp|245|error: 'void tgui::Signal::connect(unsigned int, Func, Args ...) [with Func = main(int, char**)::<lambda()>; Args = {}]', declared using local type 'main(int, char**)::<lambda()>', is used but never defined [-fpermissive]|
C:\Users\***\Olfibits Software Project\My GUI Test Project\file.h||In function 'std::vector<std::basic_string<char> > FileReadToArray(std::string)':| <=== MY MISTAKE, WILL BE FIXED SOON
C:\Users\***\Olfibits Software Project\My GUI Test Project\file.h|34|warning: control reaches end of non-void function [-Wreturn-type]| <=== MY MISTAKE, WILL BE FIXED SOON
||=== Build failed: 22 error(s), 5 warning(s) (0 minute(s), 6 second(s)) ===|

I would be very thankful for any answer.

LG
Florian
« Last Edit: August 29, 2017, 08:15:01 pm by olfibits »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Keep in mind that TGUI has its own forum.

As for your problem, where did you download your compiler from?
Did you get the one explicitly linked on the SFML download page?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Make sure everything is compatible. There exists no prebuild TGUI 0.7 libraries compatible with SFML 2.2 and MinGW 4.7.1 to my knowledge, so you should have had to build the TGUI libraries yourself.

Maybe you can try narrowing down the error. Start with an empty main.cpp file, see if it occurs when including only <SFML/Graphics.hpp> or whether you only get errors when including <TGUI/TGUI.hpp>

Your main.cpp file isn't even compatible with the compiler you use. The errors contain "main.cpp|136|error: 'to_string' is not a member of 'std'". MinGW TDM (the one that comes with codeblocks) lacks the std::to_string function. So you should definitely start with a smaller main.cpp first to only get the relevant errors and check where they occur.

If you find that the error ONLY happens when you include TGUI stuff and there is no problem with an SFML example code, then it might be that your compiler is no longer supported. Although I have automated tests that compile TGUI and its examples with GCC 4.7 on linux, the oldest MinGW version tested with TGUI is 4.9.
TGUI: C++ SFML GUI

olfibits

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
That's the code in the main.cpp now. Still 13 errors.

sf::RenderWindow window({800,600}, "Window");
    window.setFramerateLimit(60);

    tgui::Gui gui(window);

    while (window.isOpen())
    {
        sf::Event event;
        while(window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            gui.handleEvent(event);
        }

        window.clear();
        gui.draw();
        window.display();
    }

    return 0;

The first errors mentioned were about the String.hpp in SFML, that's why I asked here first - I already thought about creating a TGUI forum, I just wanted to remove error for error :)
I didn't see that a problem is with the compiler as well...
I have got the compiler and Code::Blocks IDE from a DVD inside a bought C++ book from a bookshop. Maybe that wasn't the best way to do that... it was comfortable and easy to do...

Before searching errors from SFML and TGUI, I think it's best to look about getting a updated compiler and IDE and then looking for compatible SFML+TGUI combination. If I get errors again, I will better seek assistance in the TGUI forum. I really believe that the String.hpp error comes with the compiler...

Thanks for your help,
Florian

olfibits

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
So, now I've got a updated Code::Blocks IDE as well as a new MinGW Suite.
There are still some errors with undefined references, but only to TGUI. I'll better look for assistance there.

Thanks for your help!  :)
You can set the "SOLVED" flag, I didn't find out how to do that here.