Error when compiling c++ project



  • I have some problem when build project on Qt 5.8.0
    my c++ project is using Qt version mingw53_32 qmake, using cmake on https://cmake.org/, and compilers for C++ is mingw530_32 g++.exe
    but when i build project i got this error . Someone having a solution to this?
    ps : i googled for it and ppl said it's error when using c compiler for compiling c++ file but in this case i already used g++ compiler but this error still happen.
    alt text


  • Qt Champions 2017

    @lampvux can you please show your .pro file?

    also, the Compile Output will provide more details about the problem. please show it too.

    regards

    Edit, ah CMake, so no pro file :(



  • this is all error from my Compile Output, just tell if you need something else

    In file included from C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qobjectdefs.h:48:0,
                     from C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qobject.h:46,
                     from C:\Qt\Qt5.8.0\5.8\mingw53_32\include\QtCore/qabstractanimation.h:43,
                     from C:\Qt\Qt5.8.0\5.8\mingw53_32\include\QtCore/QtCore:5,
                     from F:\Download\New folder\webissues-client-1.1.5\webissues-client-1.1.5\src\precompiled.h:23:
    C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qnamespace.h:53:7: error: unknown type name 'QMetaObject'
     const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT; // defined in qobject.h (which can't be included here)
           ^
    C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qnamespace.h:64:1: error: unknown type name 'namespace'
     namespace
     ^
    C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qnamespace.h:68:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
     Qt {
        ^
    C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qnamespace.h:1753:33: error: expected ')' before ':' token
     Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MouseButtons)
                                     ^
    C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qnamespace.h:1778:1: warning: data definition has no type or storage class
     class Q_CORE_EXPORT QInternal {
     ^
    C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qnamespace.h:1778:1: warning: type defaults to 'int' in declaration of 'class' [-Wimplicit-int]
    C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qnamespace.h:1778:21: error: expected ',' or ';' before 'QInternal'
     class Q_CORE_EXPORT QInternal {
                         ^
    In file included from C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qobjectdefs.h:50:0,
                     from C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qobject.h:46,
                     from C:\Qt\Qt5.8.0\5.8\mingw53_32\include\QtCore/qabstractanimation.h:43,
                     from C:\Qt\Qt5.8.0\5.8\mingw53_32\include\QtCore/QtCore:5,
                     from F:\Download\New folder\webissues-client-1.1.5\webissues-client-1.1.5\src\precompiled.h:23:
    C:\Qt\Qt5.8.0\5.8\mingw53_32\include/QtCore/qobjectdefs_impl.h:53:23: fatal error: type_traits: No such file or directory
    compilation terminated.
    mingw32-make[2]: *** [release/precompiled.h.gch/c] Error 1
    mingw32-make[1]: *** [release] Error 2
    mingw32-make: *** [sub-src-make_first] Error 2
    Makefile.Release:11973: recipe for target 'release/precompiled.h.gch/c' failed
    mingw32-make[2]: Leaving directory 'C:/Users/tungl/Downloads/Compressed/webissues-client-1.1.5/build-webissues-Desktop_Qt_5_8_0_MinGW_32bit-Debug/src'
    Makefile:34: recipe for target 'release' failed
    mingw32-make[1]: Leaving directory 'C:/Users/tungl/Downloads/Compressed/webissues-client-1.1.5/build-webissues-Desktop_Qt_5_8_0_MinGW_32bit-Debug/src'
    Makefile:38: recipe for target 'sub-src-make_first' failed
    14:15:49: The process "C:\Qt\Qt5.8.0\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project webissues (kit: Desktop Qt 5.8.0 MinGW 32bit)
    When executing step "Make"
    14:15:49: Elapsed time: 01:39.
    

  • Qt Champions 2017

    @lampvux please post the complete Compile Output



  • @aha_1980
    here is complete compile output log :
    Compile Output log


  • Qt Champions 2017

    @lampvux said in Error when compiling c++ project:

    @aha_1980
    here is complete compile output log :
    Compile Output log

    unaccessable for me.

    why don't you just paste it here?


  • Lifetime Qt Champion

    Hi,

    Is that project accessible somewhere ?



  • @SGaist
    yes i try to build and fix something from this open source: https://github.com/mimecorg/webissues-client



  • @aha_1980 sorry i can not upload or paste all the compile output here as the system said it's too long .
    you can try with this link: https://drive.google.com/open?id=14bor-1lEBRDu5GTnEQJriXpXkPp0W0_U


  • Qt Champions 2017

    @lampvux

    hi, thanks, now I can see it - its indeed big.

    honestly, this log looks like a mess for me. you immediately see some 'file not found' messages.

    some files are referenced from F: but most others from C:

    interstingly some files are indeed compiled by g++ and some by gcc - I can't say if that is a problem.

    I'd suggest to extract this project again.

    please use a directory without spaces ans special chars in its name.

    maybe thats already enough.



  • @aha_1980
    Thanks for your help.
    this project work well on linux but it have problem on windows.
    maybe your opinion about there files compiled by g++ and gcc is problem, i think about it too
    il try something as your advice, hope it works.
    Thanks again.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.