fatal error RC1106: invalid option: -MP in a QT app

16 Views Asked by At

I have a QT app and the WIN32 resource files AppVersion.rc and windows/winapp.rc in CMakeLists.txt:

set_target_properties(${PROJECT_NAME} PROPERTIES
    WIN32_EXECUTABLE TRUE)

string(REPLACE "." "," APP_VERSION_COMMA ${APP_VERSION})
set(CMake_RCVERSION "${APP_VERSION_COMMA},0")
set(CMake_RCVERSION_STR ${APP_VERSION})
set(VersionFile AppVersion.rc)
configure_file(windows/${VersionFile}.in ${VersionFile} @ONLY)
target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${VersionFile} windows/winapp.rc)

when I compile my app with MSVC2022 and QT 6.6.2 for Windows from the command line it compiles successfully with the following output:

ResourceCompile:
  C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\rc.exe /D _UNICODE /D UNICODE /D WIN32 /D _WINDOWS /D NDEBUG /D _UNICODE /D _CRT_SECURE_NO_
  WARNINGS /D NOMINMAX /D AWL_QT /D QT_NO_EXCEPTIONS=1 /D QT_CORE_LIB /D QT_NO_DEBUG /D _ENABLE_EXTENDED_ALIGNED_STORAGE /D WIN64 /D _WIN64 /D UNICODE /D
  QT_GUI_LIB /D QT_QUICK_LIB /D QT_QML_LIB /D QT_QMLINTEGRATION_LIB /D QT_NETWORK_LIB /D QT_QMLMODELS_LIB /D QT_OPENGL_LIB /D QT_SVG_LIB /D QT_MULTIMEDI
  A_LIB /D "CMAKE_INTDIR=\\\"RelWithDebInfo\\\"" /l"0x0409" /IC:\dev\build\lg /IC:\dev\repos\examples\src\MyApp\MyAppQt /IC:\dev\build\lg\MyAa
  meQt_autogen\include_RelWithDebInfo /IC:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\Awl /IC:\dev\repos\examples\src\MyApp\MyAppQ
  t\..\..\..\lib\Awl\Platforms\Windows /IC:\dev\repos\examples\src\MyApp\MyAppQt\..\MyApp\MyApp.Shared /IC:\dev\repos\examples\src\MyA
  ame\MyAppQt\..\..\..\lib\Qtil /IC:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\SoundPool /IC:\dev\repos\examples\src\MyApp\MyA
  ameQt\Model /IC:\dev\repos\examples\src\MyApp\MyAppQt\Advertising\Platforms\Qt /IC:\dev\repos\examples\src\MyApp\MyAppQt\Purchasing\ina
  pp /IC:\dev\repos\examples\src\MyApp\MyAppQt\Purchasing\qmltypes /IC:\dev\libs\Qt6\windows\include\QtQml\6.6.2 /IC:\dev\libs\Qt6\windows\includ
  e\QtQml\6.6.2\QtQml /IC:\dev\libs\Qt6\windows\include\QtCore\6.6.2 /IC:\dev\libs\Qt6\windows\include\QtCore\6.6.2\QtCore /IC:\dev\libs\Qt6\windows\incl
  ude\QtCore /IC:\dev\libs\Qt6\windows\include /I"C:\dev\libs\Qt6\windows\mkspecs\win32-msvc" /IC:\dev\libs\Qt6\windows\include\QtQml /IC:\dev\libs\Qt6\w
  indows\include\QtQmlIntegration /IC:\dev\libs\Qt6\windows\include\QtNetwork /IC:\dev\libs\Qt6\windows\include\QtGui /IC:\dev\libs\Qt6\windows\include\Q
  tQuick /IC:\dev\libs\Qt6\windows\include\QtQmlModels /IC:\dev\libs\Qt6\windows\include\QtOpenGL /IC:\dev\libs\Qt6\windows\include\QtSvg /IC:\dev\libs\Q
  t6\windows\include\QtMultimedia /nologo /fo"MyAppQt.dir\RelWithDebInfo\AppVersion.res" C:\dev\build\lg\platform\AppVersion.rc
  C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\rc.exe /D _UNICODE /D UNICODE /D WIN32 /D _WINDOWS /D NDEBUG /D _UNICODE /D _CRT_SECURE_NO_
  WARNINGS /D NOMINMAX /D AWL_QT /D QT_NO_EXCEPTIONS=1 /D QT_CORE_LIB /D QT_NO_DEBUG /D _ENABLE_EXTENDED_ALIGNED_STORAGE /D WIN64 /D _WIN64 /D UNICODE /D
  QT_GUI_LIB /D QT_QUICK_LIB /D QT_QML_LIB /D QT_QMLINTEGRATION_LIB /D QT_NETWORK_LIB /D QT_QMLMODELS_LIB /D QT_OPENGL_LIB /D QT_SVG_LIB /D QT_MULTIMEDI
  A_LIB /D "CMAKE_INTDIR=\\\"RelWithDebInfo\\\"" /l"0x0409" /IC:\dev\build\lg /IC:\dev\repos\examples\src\MyApp\MyAppQt /IC:\dev\build\lg\MyAa
  meQt_autogen\include_RelWithDebInfo /IC:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\Awl /IC:\dev\repos\examples\src\MyApp\MyAppQ
  t\..\..\..\lib\Awl\Platforms\Windows /IC:\dev\repos\examples\src\MyApp\MyAppQt\..\MyApp\MyApp.Shared /IC:\dev\repos\examples\src\MyA
  ame\MyAppQt\..\..\..\lib\Qtil /IC:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\SoundPool /IC:\dev\repos\examples\src\MyApp\MyA
  ameQt\Model /IC:\dev\repos\examples\src\MyApp\MyAppQt\Advertising\Platforms\Qt /IC:\dev\repos\examples\src\MyApp\MyAppQt\Purchasing\ina
  pp /IC:\dev\repos\examples\src\MyApp\MyAppQt\Purchasing\qmltypes /IC:\dev\libs\Qt6\windows\include\QtQml\6.6.2 /IC:\dev\libs\Qt6\windows\includ
  e\QtQml\6.6.2\QtQml /IC:\dev\libs\Qt6\windows\include\QtCore\6.6.2 /IC:\dev\libs\Qt6\windows\include\QtCore\6.6.2\QtCore /IC:\dev\libs\Qt6\windows\incl
  ude\QtCore /IC:\dev\libs\Qt6\windows\include /I"C:\dev\libs\Qt6\windows\mkspecs\win32-msvc" /IC:\dev\libs\Qt6\windows\include\QtQml /IC:\dev\libs\Qt6\w
  indows\include\QtQmlIntegration /IC:\dev\libs\Qt6\windows\include\QtNetwork /IC:\dev\libs\Qt6\windows\include\QtGui /IC:\dev\libs\Qt6\windows\include\Q
  tQuick /IC:\dev\libs\Qt6\windows\include\QtQmlModels /IC:\dev\libs\Qt6\windows\include\QtOpenGL /IC:\dev\libs\Qt6\windows\include\QtSvg /IC:\dev\libs\Q
  t6\windows\include\QtMultimedia /nologo /fo"MyAppQt.dir\RelWithDebInfo\winapp.res" C:\dev\repos\examples\src\MyApp\MyAppQt\platform\windows
  \winapp.rc

but when I open my CMakeLists.txt in QT Creator and try to build the app I get fatal error RC1106: invalid option: -MP error from the resource compiler and the following output:

4/41 2.9/sec] Building RC object CMakeFiles\MyAppQt.dir\platform\AppVersion.rc.res
FAILED: CMakeFiles/MyAppQt.dir/platform/AppVersion.rc.res 
C:/dev/tools/CMAKE-~1.2-W/bin/cmcldeps.exe RC C:\dev\repos\examples\src\MyApp\build-MyAppQt-Desktop_x86_windows_msvc2022_pe_64bit-Debug\platform\AppVersion.rc CMakeFiles\MyAppQt.dir\platform\AppVersion.rc.res.d CMakeFiles\MyAppQt.dir\platform\AppVersion.rc.res "Note: including file: " "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/HostX64/x64/cl.exe" C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe -DAWL_QT -DNOMINMAX -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_EXCEPTIONS=1 -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICK_LIB -DQT_SVG_LIB -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -I C:\dev\repos\examples\src\MyApp\build-MyAppQt-Desktop_x86_windows_msvc2022_pe_64bit-Debug -I C:\dev\repos\examples\src\MyApp\MyAppQt -I C:\dev\repos\examples\src\MyApp\build-MyAppQt-Desktop_x86_windows_msvc2022_pe_64bit-Debug\MyAppQt_autogen\include -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\Awl -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\Awl\Platforms\Windows -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\MyApp\MyApp.Shared -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\Qtil -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\SoundPool -I C:\dev\repos\examples\src\MyApp\MyAppQt\Model -I C:\dev\repos\examples\src\MyApp\MyAppQt\Advertising\Platforms\Qt -I C:\dev\repos\examples\src\MyApp\MyAppQt\Purchasing\inapp -I C:\dev\repos\examples\src\MyApp\MyAppQt\Purchasing\qmltypes -I C:\dev\libs\Qt6\windows\include\QtQml\6.6.2 -I C:\dev\libs\Qt6\windows\include\QtQml\6.6.2\QtQml -I C:\dev\libs\Qt6\windows\include\QtCore\6.6.2 -I C:\dev\libs\Qt6\windows\include\QtCore\6.6.2\QtCore -I C:\dev\libs\Qt6\windows\include\QtCore -I C:\dev\libs\Qt6\windows\include -I C:\dev\libs\Qt6\windows\mkspecs\win32-msvc -I C:\dev\libs\Qt6\windows\include\QtQml -I C:\dev\libs\Qt6\windows\include\QtQmlIntegration -I C:\dev\libs\Qt6\windows\include\QtNetwork -I C:\dev\libs\Qt6\windows\include\QtGui -I C:\dev\libs\Qt6\windows\include\QtQuick -I C:\dev\libs\Qt6\windows\include\QtQmlModels -I C:\dev\libs\Qt6\windows\include\QtOpenGL -I C:\dev\libs\Qt6\windows\include\QtSvg -I C:\dev\libs\Qt6\windows\include\QtMultimedia -DWIN32 -D_DEBUG   -MP /fo CMakeFiles\MyAppQt.dir\platform\AppVersion.rc.res C:\dev\repos\examples\src\MyApp\build-MyAppQt-Desktop_x86_windows_msvc2022_pe_64bit-Debug\platform\AppVersion.rc
fatal error RC1106: invalid option: -MP
[5/41 3.6/sec] Building RC object CMakeFiles\MyAppQt.dir\platform\windows\winapp.rc.res
FAILED: CMakeFiles/MyAppQt.dir/platform/windows/winapp.rc.res 
C:/dev/tools/CMAKE-~1.2-W/bin/cmcldeps.exe RC C:\dev\repos\examples\src\MyApp\MyAppQt\platform\windows\winapp.rc CMakeFiles\MyAppQt.dir\platform\windows\winapp.rc.res.d CMakeFiles\MyAppQt.dir\platform\windows\winapp.rc.res "Note: including file: " "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/HostX64/x64/cl.exe" C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe -DAWL_QT -DNOMINMAX -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_EXCEPTIONS=1 -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICK_LIB -DQT_SVG_LIB -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -I C:\dev\repos\examples\src\MyApp\build-MyAppQt-Desktop_x86_windows_msvc2022_pe_64bit-Debug -I C:\dev\repos\examples\src\MyApp\MyAppQt -I C:\dev\repos\examples\src\MyApp\build-MyAppQt-Desktop_x86_windows_msvc2022_pe_64bit-Debug\MyAppQt_autogen\include -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\Awl -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\Awl\Platforms\Windows -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\MyApp\MyApp.Shared -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\Qtil -I C:\dev\repos\examples\src\MyApp\MyAppQt\..\..\..\lib\SoundPool -I C:\dev\repos\examples\src\MyApp\MyAppQt\Model -I C:\dev\repos\examples\src\MyApp\MyAppQt\Advertising\Platforms\Qt -I C:\dev\repos\examples\src\MyApp\MyAppQt\Purchasing\inapp -I C:\dev\repos\examples\src\MyApp\MyAppQt\Purchasing\qmltypes -I C:\dev\libs\Qt6\windows\include\QtQml\6.6.2 -I C:\dev\libs\Qt6\windows\include\QtQml\6.6.2\QtQml -I C:\dev\libs\Qt6\windows\include\QtCore\6.6.2 -I C:\dev\libs\Qt6\windows\include\QtCore\6.6.2\QtCore -I C:\dev\libs\Qt6\windows\include\QtCore -I C:\dev\libs\Qt6\windows\include -I C:\dev\libs\Qt6\windows\mkspecs\win32-msvc -I C:\dev\libs\Qt6\windows\include\QtQml -I C:\dev\libs\Qt6\windows\include\QtQmlIntegration -I C:\dev\libs\Qt6\windows\include\QtNetwork -I C:\dev\libs\Qt6\windows\include\QtGui -I C:\dev\libs\Qt6\windows\include\QtQuick -I C:\dev\libs\Qt6\windows\include\QtQmlModels -I C:\dev\libs\Qt6\windows\include\QtOpenGL -I C:\dev\libs\Qt6\windows\include\QtSvg -I C:\dev\libs\Qt6\windows\include\QtMultimedia -DWIN32 -D_DEBUG   -MP /fo CMakeFiles\MyAppQt.dir\platform\windows\winapp.rc.res C:\dev\repos\examples\src\MyApp\MyAppQt\platform\windows\winapp.rc
fatal error RC1106: invalid option: -MP

Where does this -MP option go from? Does QT Creator add it?

It compiled successfully with previous versions of QT Creator and QT 6.6.0, what could have changed?

It is simply a wrong rc.exe option, so I can reproduce the error with the following command:

rc.exe -MP
fatal error RC1106: invalid option: -MP
0

There are 0 best solutions below