Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 错误RC2247:符号名称太长(winnt.h)_Windows_Winapi_Visual Studio 2017 - Fatal编程技术网

Windows 错误RC2247:符号名称太长(winnt.h)

Windows 错误RC2247:符号名称太长(winnt.h),windows,winapi,visual-studio-2017,Windows,Winapi,Visual Studio 2017,尝试在Win32应用程序中显示对话框时,收到的RC2247错误符号名称太长。此文件中出现错误: C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\winnt.h 这在VS2015下运行良好。该错误始于我升级到VS2017时 我看过以下帖子,它们似乎不相关,因为它们与prsht.h有关: 如果注释掉整个resource.rc文件,错误就会消失。如果RC包含单行,则会发生错误: #include <winnt.h&g

尝试在Win32应用程序中显示对话框时,收到的RC2247错误符号名称太长。此文件中出现错误:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\winnt.h
这在VS2015下运行良好。该错误始于我升级到VS2017时

我看过以下帖子,它们似乎不相关,因为它们与prsht.h有关:

如果注释掉整个resource.rc文件,错误就会消失。如果RC包含单行,则会发生错误:

#include <winnt.h>
当我点击编辑代码时,什么也没发生

非常感谢您的建议。

我们不能将windows.h或winnt.h添加到.rc文件-此标题-用于c/c++编译器,而不是为处理.rc文件的rc资源编译器而设计的。因此,如果我们包括这样的文件,我们可能会得到错误

我们需要包含到.rc文件。这个文件是专门为RC编译器设计的。在内部,它包括:

#include <winuser.rh>
#include <commctrl.rh>
#include <dde.rh>
#include <winnt.rh>
#include <dlgs.h>
#include <winver.h>
并定义一些宏

我们在rc文件中需要/使用的所有标准windows定义都存在于winres.h和它的子目录中。从另一个角度来看,windows.h中不存在额外的符号/定义-rc不需要这些符号/定义,有时可能会导致错误

因此,只需在资源文件的开头包含,就可以了。

我们不能将windows.h或winnt.h包含到.rc文件中-此标题-用于c/c++编译器,而不是为处理.rc文件的rc资源编译器而设计的。因此,如果我们包括这样的文件,我们可能会得到错误

我们需要包含到.rc文件。这个文件是专门为RC编译器设计的。在内部,它包括:

#include <winuser.rh>
#include <commctrl.rh>
#include <dde.rh>
#include <winnt.rh>
#include <dlgs.h>
#include <winver.h>
并定义一些宏

我们在rc文件中需要/使用的所有标准windows定义都存在于winres.h和它的子目录中。从另一个角度来看,windows.h中不存在额外的符号/定义-rc不需要这些符号/定义,有时可能会导致错误


因此,只需在资源文件的开头包含即可。

使用include in.rc文件。不包括winnt.h或windows.h。winres.h是专门为RC编译器设计的,包括内部几个rh文件,包括winnt.rh、winuser.rh等,当winnt.h是为CL而不是为设计时RC@RbMm它起作用了!令人惊叹的非常感谢。我还必须摆脱winuser.h。那么,为什么20年来这种方法一直运行正常,但突然失败了呢?我想这是一个进步。再说一次-你不需要包含winuser.h-这个文件用于c/c++编译器-你需要包含winuser.rh来代替rc。但是,当您包含winres.h时,您会自动将winuser.h、winnt.rh、commctrl.rh等winuser.h包含在RC中,这类似于将windows.h包含在CL中。在c/c++中,包括windows.h和to-RC文件包括winres.h,但决不包括在.RC文件中。不包括winnt.h或windows.h。winres.h是专门为RC编译器设计的,包括内部几个rh文件,包括winnt.rh、winuser.rh等,当winnt.h是为CL而不是为设计时RC@RbMm它起作用了!令人惊叹的非常感谢。我还必须摆脱winuser.h。那么,为什么20年来这种方法一直运行正常,但突然失败了呢?我想这是一个进步。再说一次-你不需要包含winuser.h-这个文件用于c/c++编译器-你需要包含winuser.rh来代替rc。但是,当您包含winres.h时,您会自动将winuser.h、winnt.rh、commctrl.rh等winuser.h包含在RC中,这类似于将windows.h包含在CL中。在c/c++中,包括windows.h和to-RC文件包括winres.h,但决不包括windows.h