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

Strange compilation error of resource file with Qt 6.1.1 RC



  • I have written a c++20 msvc cmake project initially based on Qt 6.0 on windows.
    Everything worked fine for the upgrade to Qt 6.1 and the project happily compiles (besides fixing a qproperty.h bug in 6.1).
    Today I downloaded the 6.1.1 Preview with maintenance tool to recompile the app. Had to locally fix qproperty.h bug here as well.

    Now I do get this very strange error:

    CMakeFiles\OrgElemTreeView.dir\orgelemtreeview.rc.res C:\Users\aea_t\Documents\development\Qt-Projekte\OrgElemTreeViewer\orgelemtreeview.rc
    clang: error: no such file or directory: '/P'
    clang: error: no such file or directory: '/DRC_INVOKED'
    clang: error: no such file or directory: '/TC'
    clang: error: no such file or directory: '/nologo'
    clang: error: no such file or directory: '/showIncludes'
    clang: error: no such file or directory: '/out:CMakeFiles\OrgElemTreeView.dir\orgelemtreeview.rc.res.dep.obj'
    ninja: build stopped: subcommand failed.
    

    This is really strange to me as it worked with previous Qt6 versions and the resource file integration in cmake is based on this document:

    IF(WIN32)
      set(app_icon_resource_windows "${CMAKE_SOURCE_DIR}/orgelemtreeview.rc")
    ENDIF(WIN32)
    
    qt_add_executable(${CMAKE_PROJECT_NAME}
        ${SOURCES}
        ${app_icon_resource_windows}
        )
    

    clang ist not installed with my MSVC installation and as I said it worked before.

    Maybe someone has a hint for me?

    Thx,

    Christian



  • Okay I finally got it to build. It seems to be caused by Qt Creator setting the C compiler in the options to clang:
    2021-06-03 (1).png

    After overriding CMAKE_C_COMPILER manually in the Projects tab I do get a successful build.

    Still I don't know why I cannot change the compiler in the 6.1.1 kit, which is possible for the 6.1.0 kit.


Log in to reply