LNK1158: cannot run 'rc.exe'
This error occurs after I installed Visual Studio 2017 and changed graphics card and its driver. Now whenever I clicked the "build" icon (the hammer) in Qt Creator, I will receive an error message "NK1158: cannot run 'rc.exe'". It looks like that this message is from Visual Studio so I reinstalled VS2015, VS2017, Windows SDK and Qt, but the same problem persists. How to solve this problem, then?
Some info about my computer:
- Windows 10 1803
- VS2015 Update 3 version 14.0.25431.01
- Visual Studio 2017 version 15.7.1
- Qt 5.10.1
If you need any other info, please let me know. Thank you for help.
pleasemake sure, that the WindowsKit bin folder is part of your Build Environment
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
Yes, that's the problem. I added "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64" into the path variable and now Qt builds correctly. Thank you very much for your help!
Pablo J. Rogina
@zzzhhhzzzhhh if your issue is solved, please don't forget to mark your post as such. Thanks.
@J-Hilk thank you for finding the fix. I was experiencing the same problem after installing Qt Creator 4.6.2 in Windows and somehow msvc2017 worked fine although msvc2015 failed to find rc.exe.
Having said that, is there a way to automatically configure the compiler to include the right path? Your fix does the trick, but I'm assuming that it requires to tweak each project each time that we intend to do a build with msvc2015.
hi @rmam ,
you're welcome :)
Have a look at this topic
QtCreator Build Environment Config File
In there @aha_1980 had the correct idea/knowledge in how to modify your kits to automatically add folders to your build environment.
But, you'll still have to do it once for each installed Kit.