Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Building Qt 5.15.2, windows 10 mingw C++17 issue
QtWS25 Last Chance

Building Qt 5.15.2, windows 10 mingw C++17 issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BeFu
    wrote on 21 Aug 2021, 13:45 last edited by
    #1

    Hi all.
    I've basic C++ knowledge and I'm new to QT. With QT and mingw I want to develop in C++ a windows app (database) for managing my private electronic components.
    I've installed my windows 10 64bit computer Qt5.15.2 with its mingw8.1 c++ compiler according to:
    20210821_QT-Setup.PNG
    Currently I'm working through C++ desktop (command line) examples (up to C++2017(2020)) of a C++ book, like the following code

    #include <iostream>
    #include <filesystem>  // c++17 required
    #include <string>
    using namespace std;
    using namespace std::filesystem; // c++17 required
    
    int main()
    {
       string basis{"C:/Temp"};
       // string basis{"/home/theis/Temp"};
       // path element{basis + "/a.txt"};
       path element{basis + "/unter"};
    
       if(!exists(element))
          return 1;
    
       cout << "Pfad:        " << element << endl;
       cout << "Verzeichnis: " << element.parent_path() << endl;
       cout << "Ganzer Name: " << element.filename() << endl;
    
       cout << "Pfadteile:   ";
       for(const auto& teil : element)
          cout << teil << " ";
       cout << endl;
    
       if(is_regular_file(element))
       {
          cout << "Pfad zu Datei" << endl;
          cout << "Name:        " << element.stem() << endl;
          cout << "Erweiterung: " << element.extension() << endl;
          cout << "Byte:        " << file_size(element) << endl;
       }
       else if(is_directory(element))
          cout << "Pfad zu Verzeichnis" << endl;
    
       path da{current_path()};
       da.append("hallo");
       da.concat(".cpp");
       cout << "Pfad:        " << da << endl;
    
       string eingabe_s;
       cout << "'E' fuer Programmende: ";
       do
       {
           getline(cin, eingabe_s);
       } while(eingabe_s != "E");
    
    }
    

    When compiling the code with these compiler settings
    *TEMPLATE = app
    CONFIG += console c++17
    CONFIG -= app_bundle
    CONFIG -= qt

    SOURCES +=
    main.cpp*

    and this kits config
    20210821_QT-Kit.PNG

    QT throws the following errors:
    20210821_QT-Errors.PNG

    I have no clue how to setup QT(5.15.2) for compiling C++17 with no compiler errors. I've tried several web-hints (like Creating C++17 enabled Qt projects or Windows, Qt 5.14.1, mingw and c++17 for solving this known issue without succuss.

    I'd appreciate, if a QT expert can give a step by step instructions how to setup QT(5.15.2) right for compiling C++17. Best would be SCREENSHOTS or even a YOUTUBE-video.

    Thank you very much,

    Bernd
    P.S.: I've installed also installed "mingw64 g++ version 11.2.0" on my windows 10 which is available in QT:
    20210821_mingw64_11-2-0.PNG

    I'd appreciate, if a QT expert give a step by step instructions how to setup QT for using the "mingw64 g++ version 11.2.0" in QT projects for compiling debug- and release apps. Best would be SCREENSHOTS or even a YOUTUBE-video.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on 22 Aug 2021, 07:40 last edited by
      #2

      This is a compiler issue, not a Qt one.

      The MingW compiler you have is GCC 8.1. C++17 support in this version is experimental and this issue with std::filesystem does not seem to have been resolved until 9.0 (when C++17 support ceased being experimental). Since your code is not using Qt you could simply install the current version of MingW64, which gives you a 9.0 compiler. "Incomplete support for the C++17 Filesystem library and the Filesystem TS on Windows," may still be an issue.

      If you subsequently want to use the Qt libraries you have then it will depend on the binary-level compatibility between the 9.x (you are using) and 8.1.x compiler output (the Qt libraries were built with). I do not know the answer here.

      Your other alternative would be to use the Microsoft tool chain and matching Qt libraries.

      B 1 Reply Last reply 23 Aug 2021, 09:33
      0
      • C ChrisW67
        22 Aug 2021, 07:40

        This is a compiler issue, not a Qt one.

        The MingW compiler you have is GCC 8.1. C++17 support in this version is experimental and this issue with std::filesystem does not seem to have been resolved until 9.0 (when C++17 support ceased being experimental). Since your code is not using Qt you could simply install the current version of MingW64, which gives you a 9.0 compiler. "Incomplete support for the C++17 Filesystem library and the Filesystem TS on Windows," may still be an issue.

        If you subsequently want to use the Qt libraries you have then it will depend on the binary-level compatibility between the 9.x (you are using) and 8.1.x compiler output (the Qt libraries were built with). I do not know the answer here.

        Your other alternative would be to use the Microsoft tool chain and matching Qt libraries.

        B Offline
        B Offline
        BeFu
        wrote on 23 Aug 2021, 09:33 last edited by
        #3

        @ChrisW67 Thank you for the quick answer.
        I've developed a desktop application with C++17 and mingw(64) > 9 successful with Microsoft Visual Studio Code (VSC).
        But I don't know how to setup a tool chain with VSC, mingw(64) and QT libraries although I've looked for such a setup in the WEB.
        Can you tell me please how I can setup such a tool chain?
        Or what you you mean with "Your other alternative would be to use the Microsoft tool chain and matching Qt libraries."?

        J 1 Reply Last reply 23 Aug 2021, 11:56
        0
        • B BeFu
          23 Aug 2021, 09:33

          @ChrisW67 Thank you for the quick answer.
          I've developed a desktop application with C++17 and mingw(64) > 9 successful with Microsoft Visual Studio Code (VSC).
          But I don't know how to setup a tool chain with VSC, mingw(64) and QT libraries although I've looked for such a setup in the WEB.
          Can you tell me please how I can setup such a tool chain?
          Or what you you mean with "Your other alternative would be to use the Microsoft tool chain and matching Qt libraries."?

          J Offline
          J Offline
          JKSH
          Moderators
          wrote on 23 Aug 2021, 11:56 last edited by
          #4

          @BeFu said in Building Qt 5.15.2, windows 10 mingw C++17 issue:

          Or what you you mean with "Your other alternative would be to use the Microsoft tool chain and matching Qt libraries."?

          Chris meant: Install MSVC 2019, and then install Qt 5.15.2 for MSVC 2019.

          Can you tell me please how I can setup such a tool chain?

          I would not recommend this route to a beginner, because it might involve building Qt from source code using MinGW > 9.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0

          4/4

          23 Aug 2021, 11:56

          • Login

          • Login or register to search.
          4 out of 4
          • First post
            4/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved