在MFC SDI应用程序中创建新对话框时找不到新对话框的IDD [英] IDD of new dialog not found when creating a new dialog within an MFC SDI application
问题描述
我正在开发MFC SDI应用程序.我使用资源向导添加了一个新对话框.我在向导中将其IDD更改为IDD_NEW_WORKSPACE_DLG.我编译了所有内容,并且得到的错误是:
错误C2065:"IDD_NEW_WORKSPACE_DLG":未声明的标识符
这在resource.h中定义.我发现摆脱此错误的唯一方法是添加
I am developing an MFC SDI application. I have added a new dialog using the resource wizard. I changed its IDD to IDD_NEW_WORKSPACE_DLG in the wizard. I compiled everything and the error I get is:
error C2065: ''IDD_NEW_WORKSPACE_DLG'' : undeclared identifier
This is defined in resource.h. The only way i have found to get rid of this error is to add
#include "resource.h"
到新对话框类的头文件.
这对我来说似乎不正确-我已经完成MFC已有8年之久,我不记得必须这样做.我什至尝试创建一个新对话框,而没有更改最初选择的对话框名称(IDD_DIALOG1),它也有相同的问题.
有什么想法吗?我错过了什么吗?我已经搜索过,但找不到答案.
非常感谢
to the header file for my new dialog class.
This does not seem right to me - I havn''t done MFC for about 8 years and I can''t remember having to do this. I even tried creating a new dialog without changing the dialog name from the one originally chosen (IDD_DIALOG1) and it had the same problem.
Any ideas please? Have I missed something. I have searched but cannot find an answer to this.
Many thanks
推荐答案
您是否尝试过全部重建?您的所有文件不是只读文件,因此可以通过向导进行编辑吗?
Have you tried a rebuild all ? Are all your files not read only, so they can be edited by the wizard ?
为什么看起来不正确?编译器需要将该定义转换为数字资源ID,因此,除非您在源代码中的其他位置定义了该定义,否则您必须包括相关的标头.
Why does it not seem right? The definition is needed by the compiler to convert it to a numeric resource id, so unless you have it defined somewhere else in your source code then you must include the relevant header.
这篇关于在MFC SDI应用程序中创建新对话框时找不到新对话框的IDD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!