【问题标题】:Failed to compile PuTTY for Windows: fatal error RC1015: cannot open include file 'winresrc.h'无法为 Windows 编译 PuTTY:致命错误 RC1015:无法打开包含文件“winresrc.h”
【发布时间】:2020-12-06 14:35:15
【问题描述】:

我正在尝试在我的 Windows 10 机器上编译 PuTTY for Windows。下载source code 后,我按照自述文件中的步骤操作:

For building on Windows:

 - windows/Makefile.vc is for command-line builds on MS Visual C++
   systems. Change into the `windows' subdirectory and type `nmake
   -f Makefile.vc' to build all the PuTTY binaries.

我需要将以下路径添加到PATH 环境变量中:

C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64

因为Makefile.vc 在没有绝对路径的情况下调用rc
我运行 make 文件并收到以下错误:

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 路径复制该文件:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winresrc.h

但即使我将包含文件复制到Putty For Windows\windows 的文件夹后,我也收到了同样的错误。

【问题讨论】:

  • nmake -f makefile.vc 必须在为安装 VC++(或 VC++ 构建工具)配置的 cmd 提示符下运行,这不仅意味着 PATH,还意味着 INCLUDE、LIB 和整个环境。打开developer command prompt 并在该提示符处运行nmake 命令。
  • @dxiv 谢谢,它有效。请将其发布为答案,我会将其标记为已解决

标签: c windows makefile compiler-errors putty


【解决方案1】:

nmake -f makefile.vc 必须在为安装 VC++(或 VC++ 构建工具)而配置的 cmd 提示符下运行,这不仅意味着 PATH,还意味着 INCLUDE、LIB 等。如果在 @987654321 下运行,它将起作用@,正确设置整个环境。

作为替代方案,PuTTY for Windows package 附带 Visual C++ .sln.vcxproj 项目文件,用于从 IDE 构建。 windows\vs2012\putty.sln 解决方案可以很好地导入最新的 VS 2019,并在修复 putty-src\windows\version.rc2 中的标头引用后构建(尽管有很多警告)。

    #include "..\\version.h"  // instead of "version.h"
    #include "..\\licence.h"  // instead of "license.h"

【讨论】:

    猜你喜欢
    • 2017-10-31
    • 1970-01-01
    • 2016-03-29
    • 1970-01-01
    • 2011-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多