Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/145.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
C++ Visual Studio 2017不断将IDC_STATIC添加到我的资源中。h导致编译警告_C++_Visual Studio 2017_Mfc_Resource Editor - Fatal编程技术网

C++ Visual Studio 2017不断将IDC_STATIC添加到我的资源中。h导致编译警告

C++ Visual Studio 2017不断将IDC_STATIC添加到我的资源中。h导致编译警告,c++,visual-studio-2017,mfc,resource-editor,C++,Visual Studio 2017,Mfc,Resource Editor,从我用File->New->project对话框从头开始创建的项目的第一次编译,创建基于对话框的MFC应用程序开始,我得到了以下警告: 1>c:\local\proj_vc17\diskovery\triage\resource.h(69): warning C4005: 'IDC_STATIC': macro redefinition 1>c:\program files\microsoft visual studio\2017\community\vc\tools\msvc\14

从我用File->New->project对话框从头开始创建的项目的第一次编译,创建基于对话框的MFC应用程序开始,我得到了以下警告:

1>c:\local\proj_vc17\diskovery\triage\resource.h(69): warning C4005: 'IDC_STATIC': macro redefinition
1>c:\program files\microsoft visual studio\2017\community\vc\tools\msvc\14.14.26428\atlmfc\include\afxres.h(343): note: see previous definition of 'IDC_STATIC'
作为一个来自Unix的C/C++老手,问题是什么是显而易见的,但不是为什么会发生。我无法删除它,因为资源编译器步骤(我不知道如何看到命令行执行此操作——在project->Properties->Resources->command line中不可见,也不通过选择project->Properties->Resources->Suppress Startup Banner=no可见)包括
Resource.h
,但不包括
afxres.h
。因此,我添加了一个条件编译:

#ifndef IDC_STATIC
#define IDC_STATIC                      -1
#endif
自从上次修复以来,我有好几天没有收到这个错误,但我在对话框编辑器中创建了一个新按钮,我称之为IDC_HELP。然后,资源编辑器将其适当地放入
resource.h
,其中它与光标ID冲突。我将我的按钮重命名为IDC_帮助B,但现在未使用的IDC_帮助没有从resource.h中删除,因此需要手动编辑。(MSFT注意:不允许控件ID与MSFT定义的符号冲突。)好的,我不想这样做,但我看不到替代方法:我手动编辑
Resource.h
以删除IDC\u帮助。由于某种原因,它随后重新生成
Resource.h
。。。幸好没有重新添加IDC_帮助,但再次删除IDC_静态的条件编译

我对确切的问题没有足够的把握,不知道我的问题是什么!我应该问一下,如何从Resource.h中删除一个未使用(和冲突)的符号?或者我应该问IDC_STATIC最初是如何进入那里的

参考资料.h。只有手工编辑是围绕IDC_静态的条件编译,MSFT放在那里,而不是我

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Triage.rc
//
#define IDC_MYICON                      2
#define IDD_FOOBAR_DIALOG               102
#define IDS_APP_TITLE                   103
#define IDD_ABOUTBOX                    103
#define IDM_ABOUT                       104
#define IDI_FOOBAR                      107
#define IDI_SMALL                       108
#define IDC_FOOBAR                      109
#define IDR_MAINFRAME                   128
#define IDD_DIALOG1                     129
#define IDD_WINFOOBAR                   129
#define IDD_FOOBAR                      129
#define IDR_WINFOOBAR                   130
#define IDR_FOOBAR                      130
#define IDI_ICON1                       131
#define IDI_DIR                         131
#define IDD_START                       132
#define IDD_PROGRESS                    133
#define IDC_ICHI                        1000
#define IDC_NI                          1001
#define IDC_SAN                         1002
#define IDC_SHI                         1003
#define IDC_GO                          1004
#define IDC_ROKU                        1005
#define IDC_SHOWOK                      1006
#define IDC_NANA                        1007
#define IDC_HACHI                       1008
#define IDC_DIRL                        1009
#define IDC_DIR                         1010
#define IDC_UP                          1011
#define IDC_EXPLORER                    1012
#define IDC_PROPERTIES                  1013
#define IDC_SELSUM                      1014
#define IDC_DIRSUM                      1015
#define IDC_BROWSE                      1017
#define IDC_KU                          1018
#define IDC_GREETING                    1019
#define IDC_ROOTL                       1020
#define IDC_ERROR                       1021
#define IDC_PROGRESS                    1022
#define IDC_ERRORL                      1023
#define IDC_SEP                         1024
#define IDC_BUTTON1                     1025
#define IDC_HELPB                       1027
#define ID_OPEN_                        32771
#define ID_FILE_OPENLISTS               32772
#define ID_FILE_EX                      32773
#define ID_FILE_JUU                     32774
#define ID_FILE_JUUICHI                 32775
#define ID_VIEW_ALLSIZEDATA             32776
#define ID__UNDO                        32777
#define ID__REDO                        32778
#define ID_SAVELISTS                    32779
#define ID_FILE_JUUNI                   32780
#define ID_FILE_JUUSAN                  32781
#define ID_FILE_EXIT                    32782
#define ID_FILE_SAVELISTS               32783
#define ID_UNDO                         32784
#define ID_REDO                         32785
#define ID_OPENLISTS                    32786
#define ID_JUUGO                        32787
#define ID_JUUROKU                      32788
#define ID_EXIT                         32789
#define ID_ALLSIZEDATA                  32790
#ifndef IDC_STATIC
#define IDC_STATIC                      -1
#endif

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC                     1
#define _APS_NEXT_RESOURCE_VALUE        134
#define _APS_NEXT_COMMAND_VALUE         32791
#define _APS_NEXT_CONTROL_VALUE         1029
#define _APS_NEXT_SYMED_VALUE           110
#endif
#endif
这是我的RC文件的序言。我注意到它与新创建的基于对话框的新项目-->MFC-->MFC应用程序-->有些不同,但我相信这也是我创建此项目的方式

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_FOOBAR              ICON                    "Foobar.ico"

IDI_SMALL               ICON                    "small.ico"

IDI_DIR                 ICON                    "dir.ico"


/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//

IDC_FOOBAR ACCELERATORS
BEGIN
    "?",            IDM_ABOUT,              ASCII,  ALT
    "/",            IDM_ABOUT,              ASCII,  ALT
END


/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUTBOX DIALOGEX 0, 0, 203, 63
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Foobar"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
    ICON            IDR_MAINFRAME,IDC_STATIC,14,14,21,20
    LTEXT           "Foobar Analyzer, v. 3.2",IDC_STATIC,42,14,154,8,SS_NOPREFIX
    LTEXT           "Copyright (C) 2019.  All rights reserved.",IDC_STATIC,42,26,154,8
    DEFPUSHBUTTON   "OK",IDOK,146,42,50,14,WS_GROUP
END

(然后该文件描述了应用程序的其他对话框。)

如果您已经显示了resource.h文件,那么回答这个问题会容易得多。手工编辑是有风险的,通常由资源编辑器维护。这不是一个拥有成熟C解析器的复杂软件,它试图通过简单的文本搜索找到生成#定义的位置。我猜IDC_静态定义被移到了错误的地方。看一看一个新项目产生的新项目,我认为#ifdef APSTUDIO#u的位置很重要。之前的内容不会被弄乱。
IDC\u STATIC
不应在
resource.h
中定义。请回答您的问题并添加
resource.h
的内容。完成。。。。。。。。。。。