Qt cannot find rc.exe Codes: fatal error RC1106: invalid option: -ologo, LNK1327 / LNK1158 : fatal error during running rc.exe



  • https://bugreports.qt.io/browse/QTCREATORBUG-20637

    I have not found what causes this, but will gladly provide any more details/diagnostics needed. This problem appears to be low priority as it few users have reported having it, and there is a relatively easy fix.

    FIX: Going to Tools -> Options -> Build and Run -> Kits -> (The kit you are using) -> then adding the proper directory to the Environment with the "PATH=${PATH};" command. Example in attachments. To find the file path, follow mine to the bin folder and select the one you need.

    Thanks to @aha_1980 @kkoehne and @J.Hilk

    Codes:

    LINK : fatal error LNK1158: cannot run 'rc.exe'

    LINK : fatal error LNK1327: cannot run 'rc.exe'

    fatal error RC1106: invalid option: -ologo

    4_1530718497404_Capture4.PNG 3_1530718497404_Capture3.PNG 2_1530718497404_Capture2.PNG 1_1530718497404_Capture1.PNG 0_1530718497403_Capture.PNG

    Compile output 1/2:

    • 07:53:21: Running steps for project untitled...

    • 07:53:21: Configuration unchanged, skipping qmake step.

    • 07:53:21: Starting: "D:\Qt\Tools\QtCreator\bin\jom.exe"

    • D:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug

    • link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST:embed /OUT:debug\untitled.exe @C:\Users\willi\AppData\Local\Temp\untitled.exe.10340.16.jom

    • fatal error RC1106: invalid option: -ologo

    • LINK : fatal error LNK1327: failure during running rc.exe

    • jom: D:\Documents\build-untitled-Desktop_Qt_5_11_0_MSVC2015_32bit-Debug\Makefile.Debug [debug\untitled.exe] Error 1327

    • jom: D:\Documents\build-untitled-Desktop_Qt_5_11_0_MSVC2015_32bit-Debug\Makefile [debug] Error 2

    • 07:53:22: The process "D:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.

    • Error while building/deploying project untitled (kit: Desktop Qt 5.11.0 MSVC2015 32bit)

    • The kit Desktop Qt 5.11.0 MSVC2015 32bit has configuration issues which might be the root cause for this problem.

    • When executing step "Make"

    • 07:53:22: Elapsed time: 00:00.

    Compile Output 2/2:

    • 11:23:23: Running steps for project untitled3...

    • 11:23:23: Starting: "D:\Qt\5.11.1\msvc2015\bin\qmake.exe" D:\Documents\untitled3\untitled3.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"

    • Info: creating stash file D:\Documents\build-untitled3-Desktop_Qt_5_11_1_MSVC2015_32bit-Debug.qmake.stash

    • 11:23:23: The process "D:\Qt\5.11.1\msvc2015\bin\qmake.exe" exited normally.

    • 11:23:23: Starting: "D:\Qt\Tools\QtCreator\bin\jom.exe" qmake_all

    • jom 1.1.2 - empower your cores

    • 11:23:23: The process "D:\Qt\Tools\QtCreator\bin\jom.exe" exited normally.

    • 11:23:23: Starting: "D:\Qt\Tools\QtCreator\bin\jom.exe"

    • D:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug

    • D:\Qt\5.11.1\msvc2015\bin\uic.exe ..\untitled3\mainwindow.ui -o ui_mainwindow.h

    • cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\untitled3.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\untitled3 -I. -I....\Qt\5.11.1\msvc2015\include -I....\Qt\5.11.1\msvc2015\include\QtWidgets -I....\Qt\5.11.1\msvc2015\include\QtGui -I....\Qt\5.11.1\msvc2015\include\QtANGLE -I....\Qt\5.11.1\msvc2015\include\QtCore -Idebug -I. -I\include -I....\Qt\5.11.1\msvc2015\mkspecs\win32-msvc -Fodebug\ @C:\Users\willi\AppData\Local\Temp\main.obj.11648.16.jom

    • cl -BxD:\Qt\5.11.1\msvc2015\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E ....\Qt\5.11.1\msvc2015\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h

    • main.cpp

    • cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\untitled3.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\untitled3 -I. -I....\Qt\5.11.1\msvc2015\include -I....\Qt\5.11.1\msvc2015\include\QtWidgets -I....\Qt\5.11.1\msvc2015\include\QtGui -I....\Qt\5.11.1\msvc2015\include\QtANGLE -I....\Qt\5.11.1\msvc2015\include\QtCore -Idebug -I. -I\include -I....\Qt\5.11.1\msvc2015\mkspecs\win32-msvc -Fodebug\ @C:\Users\willi\AppData\Local\Temp\mainwindow.obj.11648.31.jom

    • mainwindow.cpp

    • D:\Qt\5.11.1\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --compiler-flavor=msvc --include debug/moc_predefs.h -ID:/Qt/5.11.1/msvc2015/mkspecs/win32-msvc -ID:/Documents/untitled3 -ID:/Qt/5.11.1/msvc2015/include -ID:/Qt/5.11.1/msvc2015/include/QtWidgets -ID:/Qt/5.11.1/msvc2015/include/QtGui -ID:/Qt/5.11.1/msvc2015/include/QtANGLE -ID:/Qt/5.11.1/msvc2015/include/QtCore -I. -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" ..\untitled3\mainwindow.h -o debug\moc_mainwindow.cpp

    • cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\untitled3.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\untitled3 -I. -I....\Qt\5.11.1\msvc2015\include -I....\Qt\5.11.1\msvc2015\include\QtWidgets -I....\Qt\5.11.1\msvc2015\include\QtGui -I....\Qt\5.11.1\msvc2015\include\QtANGLE -I....\Qt\5.11.1\msvc2015\include\QtCore -Idebug -I. -I\include -I....\Qt\5.11.1\msvc2015\mkspecs\win32-msvc -Fodebug\ @C:\Users\willi\AppData\Local\Temp\moc_mainwindow.obj.11648.375.jom

    • moc_mainwindow.cpp

    • link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST:embed /OUT:debug\untitled3.exe @C:\Users\willi\AppData\Local\Temp\untitled3.exe.11648.1359.jom

    • LINK : fatal error LNK1158: cannot run 'rc.exe'

    • jom: D:\Documents\build-untitled3-Desktop_Qt_5_11_1_MSVC2015_32bit-Debug\Makefile.Debug [debug\untitled3.exe] Error 1158

    • jom: D:\Documents\build-untitled3-Desktop_Qt_5_11_1_MSVC2015_32bit-Debug\Makefile [debug] Error 2

    • 11:23:25: The process "D:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.

    • Error while building/deploying project untitled3 (kit: Desktop Qt 5.11.1 MSVC2015 32bit)

    • The kit Desktop Qt 5.11.1 MSVC2015 32bit has configuration issues which might be the root cause for this problem.

    • When executing step "Make"

    • 11:23:25: Elapsed time: 00:02.


  • Qt Champions 2017

    @Anyone700 hi and welcome (again)

    so where do we start?!

    • can you post screenshots from compilers and kits in Tools > Options?
    • have you already searched your hard disk for rc.exe (or was it rcc.exe). i bet you have multiple versions and link.exe picks up the wrong one

    regards



  • @aha_1980 After re-installing a second time, I got a different readout. I may have selected a different kind of project though. Also, I have multiple of both and some other weird files. Anything else I can do to help?
    1_1530310959129_Capture1.PNG 0_1530310959129_Capture.PNG 0_1530311060524_Capture2.PNG
    18:13:41: Running steps for project untitled1...
    18:13:41: Starting: "D:\Qt\5.11.1\msvc2015\bin\qmake.exe" D:\Documents\untitled1\untitled1.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"
    Info: creating stash file D:\Documents\build-untitled1-Desktop_Qt_5_11_1_MSVC2015_32bit-Debug.qmake.stash
    18:13:44: The process "D:\Qt\5.11.1\msvc2015\bin\qmake.exe" exited normally.
    18:13:44: Starting: "D:\Qt\Tools\QtCreator\bin\jom.exe" qmake_all

    jom 1.1.2 - empower your cores

    18:13:45: The process "D:\Qt\Tools\QtCreator\bin\jom.exe" exited normally.
    18:13:45: Starting: "D:\Qt\Tools\QtCreator\bin\jom.exe"
    D:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
    D:\Qt\5.11.1\msvc2015\bin\uic.exe ..\untitled1\mainwindow.ui -o ui_mainwindow.h
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\untitled1.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\untitled1 -I. -I....\Qt\5.11.1\msvc2015\include -I....\Qt\5.11.1\msvc2015\include\QtWidgets -I....\Qt\5.11.1\msvc2015\include\QtGui -I....\Qt\5.11.1\msvc2015\include\QtANGLE -I....\Qt\5.11.1\msvc2015\include\QtCore -Idebug -I. -I\include -I....\Qt\5.11.1\msvc2015\mkspecs\win32-msvc -Fodebug\ @C:\Users\willi\AppData\Local\Temp\main.obj.12680.0.jom
    cl -BxD:\Qt\5.11.1\msvc2015\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E ....\Qt\5.11.1\msvc2015\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h
    main.cpp
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\untitled1.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\untitled1 -I. -I....\Qt\5.11.1\msvc2015\include -I....\Qt\5.11.1\msvc2015\include\QtWidgets -I....\Qt\5.11.1\msvc2015\include\QtGui -I....\Qt\5.11.1\msvc2015\include\QtANGLE -I....\Qt\5.11.1\msvc2015\include\QtCore -Idebug -I. -I\include -I....\Qt\5.11.1\msvc2015\mkspecs\win32-msvc -Fodebug\ @C:\Users\willi\AppData\Local\Temp\mainwindow.obj.12680.15.jom
    mainwindow.cpp
    D:\Qt\5.11.1\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --compiler-flavor=msvc --include debug/moc_predefs.h -ID:/Qt/5.11.1/msvc2015/mkspecs/win32-msvc -ID:/Documents/untitled1 -ID:/Qt/5.11.1/msvc2015/include -ID:/Qt/5.11.1/msvc2015/include/QtWidgets -ID:/Qt/5.11.1/msvc2015/include/QtGui -ID:/Qt/5.11.1/msvc2015/include/QtANGLE -ID:/Qt/5.11.1/msvc2015/include/QtCore -I. -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" ..\untitled1\mainwindow.h -o debug\moc_mainwindow.cpp
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\untitled1.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\untitled1 -I. -I....\Qt\5.11.1\msvc2015\include -I....\Qt\5.11.1\msvc2015\include\QtWidgets -I....\Qt\5.11.1\msvc2015\include\QtGui -I....\Qt\5.11.1\msvc2015\include\QtANGLE -I....\Qt\5.11.1\msvc2015\include\QtCore -Idebug -I. -I\include -I....\Qt\5.11.1\msvc2015\mkspecs\win32-msvc -Fodebug\ @C:\Users\willi\AppData\Local\Temp\moc_mainwindow.obj.12680.984.jom
    moc_mainwindow.cpp
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST:embed /OUT:debug\untitled1.exe @C:\Users\willi\AppData\Local\Temp\untitled1.exe.12680.1922.jom
    LINK : fatal error LNK1158: cannot run 'rc.exe'
    jom: D:\Documents\build-untitled1-Desktop_Qt_5_11_1_MSVC2015_32bit-Debug\Makefile.Debug [debug\untitled1.exe] Error 1158
    jom: D:\Documents\build-untitled1-Desktop_Qt_5_11_1_MSVC2015_32bit-Debug\Makefile [debug] Error 2
    18:13:48: The process "D:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
    Error while building/deploying project untitled1 (kit: Desktop Qt 5.11.1 MSVC2015 32bit)
    The kit Desktop Qt 5.11.1 MSVC2015 32bit has configuration issues which might be the root cause for this problem.
    When executing step "Make"
    18:13:48: Elapsed time: 00:07.![0_1530311017102_Capture2.PNG]


  • Qt Champions 2017

    @Anyone700 hi,

    • from your compilers tab I see that hou have two MSVC versions (14.0 and 15.0) installed. Is this expected? things may be easier if you uninstall the unneeded version.

    • you installed a lot of Qt versions, why? for desktop you only need one version fitting your compiler, e.g. MSVC 2015 32 bit.

    Note that both is allowed to have, but makes troubleshooting a lot more complicated.

    regards

    PS: you now have the opposite, rc.exe is not found at all.



  • @aha_1980 I uninstalled the one I did not need. I do not know why I have more than one MSCV version, but I did not install either, so I assume one of the programs I use installed it and uses it. How do I make it find rc.exe?


  • Qt Champions 2017

    hi @Anyone700

    I hope someone with Windows/MSVC can help you better here. I do not even know where the correct rc.exe is located, I had assumed it would be in parallel to cl.exe and link.exe.

    if that is not the case, some clever PATH manipulation might do the trick, although that does not seem the cleanest solution.

    regards


  • Moderators

    rcc.exe is nowadays part of the Windows Kit, while cl.exe is part of Visual Studio. For me (latest Visual Studio 2017 amd64), this is e.g.

    D:>where rc.exe
    C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64\rc.exe
    
    D:>where cl.exe
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\cl.exe
    

    Try to launch the Visual Studio Command Prompt; it should put the right directories in your PATH. Is rc.exe and cl.exe available in there?



  • I believe we had this recently,

    https://forum.qt.io/topic/90839/lnk1158-cannot-run-rc-exe

    the topic is marked unsolved, but the posted solution does work.



  • @kkoehne I am a complete beginner. Please walk me through this
    -Where is "Visual Studio Command Prompt"
    -Where to edit Qt's PATH


  • Moderators

    For how to find the Visual Studio Command Prompt, see https://msdn.microsoft.com/en-us/library/f35ctcxw.aspx .

    After opening the prompt, run

    where rc.exe
    rc.exe -v
    where cl.exe
    cl.exe -v

    If you can run these commands successfully, it at least means your Visual Studio installation is complete.



  • @kkoehne I think you misunderstand. I need to add: "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64" to the Qt Build Environment. I do not know how to get to this window to do that: https://ddgobkiprc33d.cloudfront.net/3f7cdac6-e900-47e8-be4e-a9a1338d0d4c.png


  • Qt Champions 2017

    @Anyone700

    Tools > Options > Build&Run > Kits > «Your MSVC Kit» > Build Environment



  • @aha_1980 I already looked there and this is what I see.
    0_1530559095630_Capture.PNG
    It bothers me that Qt does not function on install for some of it's users and when reported. Was closed as "Not a bug".


  • Qt Champions 2017

    @Anyone700 because it is no Qt bug. As MS compilers need to be set up separately, they, well need to be set up correctly.

    So why don't you use the 'Change' button next to Environment to add the path to rcc.exe?



  • @aha_1980 The solutions discussed in the other thread appear to be in a different window. To use the one you led me to, I would need a command line.

    Visual community, Dev C++, Code Blocks, and RAD studio all run without this problem.

    0_1530567307792_Capture.PNG

    @J.Hilk said in LNK1158: cannot run 'rc.exe':

    hi, @zzzhhhzzzhhh

    pleasemake sure, that the WindowsKit bin folder is part of your Build Environment

    0_1526642474311_2650c212-8bf8-4133-8c63-8e24436325f6-image.png

    i had this issue a couple of month back, that the windows kit was no longer automatically found and I had to add it manually


  • Moderators

    @Anyone700, Open the "Edit Environment" field for your kit and put

    PATH=${PATH};C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64
    

    there. Anyhow, this shouldn't really be necessary; Qt Creator sets the right paths itself by executing the Visual Studio Command Prompt (or rather: vcvarsall.bat) once, and extracting the PATH from there. Hence my request to check whether the path is correctly set in your Visual Studio Command Prompt.



  • @kkoehne It works now. Before I go ahead and close this, I would like to figure out why this is happening and what I can do to make it never happen again. For anyone.

    Here is what happens when I run those commands:
    0_1530618190128_Capture.PNG


  • Moderators

    @Anyone700 Looks good. Just the parameter -v is wrong and cl expects a source file as input which is missing.



  • @jsulm So why did Qt not get the right settings on install? What else can I do to help?


  • Qt Champions 2017

    @Anyone700

    I still think you have some weird setup problem.

    In your first post, you have MSVC2015, but in your screenshot you have MSVC2017.

    Your developer command prompt works, so it should work in Creator too. We had some problems when running the .bat took excessive long, that may also be a problem.

    Another Windows typical problem is, if PATH contains invalid directories, following (valid) directories may be ignored.

    Hard to tell from my side whats going on on your system.



  • @aha_1980 The cause is moot, Qt fails expected behavior. I would argue that this is not an important bug to fix as it effects few users and has an easy fix. However it should be listed so the community can decide if it wants to fix it. I will re-list this issue with the new information found here, mark this as solved as it found a fix, and will continue to provide help figure this out here: https://bugreports.qt.io/browse/QTCREATORBUG-20637


Log in to reply
 

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