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.
-
hi, @zzzhhhzzzhhh
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!
-
@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 FileIn 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.
Greetings.
-
I know this is old but the real reason for the missing rc.exe is a bug in Microsoft SDKs path installation.
Here is a "cleaner" fix : https://stackoverflow.com/questions/43847542/rc-exe-no-longer-found-in-vs-2015-command-prompt -
Hello everyone,
I have the same issue, but I can't find the Build Environment settings in Qt5, can you show me where to find it?
Thanks in advance -
@kamalberahal You mean in QtCreator not Qt5 I guess?
On the left side click on "Projects", select the Kit you're using and go to Build. -
Yes sorry that's what I meant. Thanks a lot, I have found ir
-
@stoplight said in LNK1158: cannot run 'rc.exe':
but the qt is by default meant to build for the 2015 version
Newer Qt versions are available for VS2017 as well.
-
This post is deleted!