Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

"Qt requires a C++11 compiler..." (WebAssembly build)



  • Hi I am trying to create a WebAssembly project. I have followed the steps and built Qt as described here: https://wiki.qt.io/Qt_for_WebAssembly. I tried building a newly created widget form project, and it succeeded, however now I'm trying to build the project that I have developed, which is giving me a lot of errors, the first one being:

    .....
    In file included from ..\..\..\Qt\WABuild\qt-everywhere-src-5.13.0\qtbase\include\QtCore/qcompilerdetection.h:1:
    ..\..\..\Qt\WABuild\qt-everywhere-src-5.13.0\qtbase\include\QtCore/../../src/corelib/global/qcompilerdetection.h:564:6: error: Qt requires a C++11 compiler and yours does not seem to be that.
    #    error Qt requires a C++11 compiler and yours does not seem to be that.
    

    So if that is the case, how do I enable C++11 support?


  • Lifetime Qt Champion

    @kayote said in "Qt requires a C++11 compiler..." (WebAssembly build):

    So if that is the case, how do I enable C++11 support?

    In pro file add this:

    CONFIG += c++11
    

    Make sure you use a compiler which actually supports C++11.



  • @jsulm
    Actually I have already added that to the .pro file, and that didn't work. When I build the project with my normal Qt MingGW installation, it works fine, but when I use the Qt 5.13 version built from source I get this error.
    Thanks for helping.


  • Lifetime Qt Champion

    @kayote What is the exact version of your MinGW compiler? Did you install any other MinGW in the past which is your PATH?



  • @jsulm
    The exact version of the compiler is MinGW 7.3.0 64-bit. There is no other versions installed, I checked my PATH and i only have "C:\Qt\Tools\mingw730_64\bin" which is the version I'm using.


  • Lifetime Qt Champion

    @kayote This is strange.
    Try to delete the build directory, run qmake and build again.



  • @jsulm
    I finally got working, somehow

    So the way I first built the project was this:

    1. cd path/to/project/with/pro/file
    2. C:\Qt\WABuild\qt-everywhere-src-5.13.0\qtbase\bin\qmake.exe && mingw32-make

    Which is the way described in the "Qt for WebAssembly" page, but then I did this instead:

    1. C:\Qt\WABuild\qt-everywhere-src-5.13.0\qtbase\bin\qmake.exe path/to/project/with/pro/file && mingw32-make.exe

    And now it works! I'm not really sure why these two are different, but at least it works.
    Thanks for the help.


Log in to reply