Windows 10下用nmake编译PuTTY源码出现RC1015无法打开winresrc.h错误如何解决?
Windows 10 编译PuTTY触发资源编译器头文件找不到的报错
我在Windows 10设备上尝试编译Windows版本PuTTY,下载源码包后按照自带README的步骤操作构建。
官方README中标注的Windows平台构建流程:
windows/Makefile.vc适配MS Visual C++命令行构建环境,进入windows子目录后,执行nmake -f Makefile.vc就能生成全部PuTTY二进制可执行文件。
为了解决构建时找不到资源编译器的问题,我把以下Windows SDK工具路径加入了系统PATH环境变量:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64
添加该路径的原因是Makefile.vc调用rc资源编译器时没有写绝对路径,不手动配置PATH的话系统定位不到这个命令行工具。
实际执行nmake构建命令后,终端输出了如下错误:
C:\Users\myuser\Desktop\Putty For Windows\windows>"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\nmake.exe" -f Makefile.vc Microsoft (R) Program Maintenance Utility Version 14.00.24234.1 Copyright (C) Microsoft Corporation. All rights reserved. rc /Fopageant.res -r -I..\./ -I..\charset/ -I..\windows/ -I..\unix/ -DWIN32 -D_WIN32 -DWINVER=0x0400 ..\windows\pageant.rc Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384 Copyright (C) Microsoft Corporation. All rights reserved. ..\windows\rcstuff.h(15) : fatal error RC1015: cannot open include file 'winresrc.h'. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\rc.EXE"' : return code '0x1' Stop.
报错提示资源编译器无法打开winresrc.h头文件。这个文件不存在于PuTTY源码目录中,我尝试从本机Windows 10 SDK的安装路径拷贝该文件排查,文件对应的SDK路径为:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winresrc.h
但哪怕把这个头文件直接拷贝到Putty For Windows\windows源码目录下,依然会触发完全相同的报错。
内容的提问来源于stack exchange,提问作者E235
相关产品推荐
相关产品推荐

