[Solved] Qt5.2.1 header compilation errors

  • After finally figuring out how to link Qt5 using CMake...I am now running into issues with the Qt header files. You can see the full extent of the errors "here on dpaste":http://dpaste.com/hold/1639740/ . I am using MinGW32/MSYS/g++ to compile the test application.

    Some of the errors are
    /C/Qt/Qt5.2.1/5.2.1/mingw48_32/include/QtCore/qgenericatomic.h:95: warning: gnu_inline' attribute directive ignored ... /C/Qt/Qt5.2.1/5.2.1/mingw48_32/include/QtCore/qstring.h:664: error: expected unqualified-id before '&' token /C/Qt/Qt5.2.1/5.2.1/mingw48_32/include/QtCore/qstring.h:664: error: expected,' or `...' before '&' token

    Source code:

    #include <QApplication>

    int main(int argc, char **argv) {
    QApplication app(argc, argv);

    return app.exec();

    and CMakeLists

    cmake_minimum_required(VERSION 2.8.11)


    set(CMAKE_PREFIX_PATH "C:\Qt\Qt5.2.1\5.2.1\mingw48_32;C:\Program Files\Microsoft SDKs\Windows\v7.0")


    add_executable(helloqt helloqt.cpp)

    target_link_libraries(helloqt Qt5::Widgets)

  • Okay, I was able to solve this problem. If I remember correctly, I had to use the correct MinGW-builds toolchain. 32bit-dwarf-posix

Log in to reply

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