Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

warning C4005: 'IDC_STATIC' : macro redefinition

Status
Not open for further replies.

RiderJon

Programmer
Aug 26, 2002
190
FR
HI:

I wanted to create a dialog-less with access to most of the MFC features. Hence I created a simple Win32 app in VC++. What I did was comment out:

//ShowWindow(hWnd, nCmdShow);
//UpdateWindow(hWnd);

from the function InitInstance( , )

Next I added the following lines in StdAfx.h below the line
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

// MY ADDITIONS
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

Now I get this warning (but no errors) that baffles me. However the prgoram runs as expected.

ERROR:

c:\documents and settings\admin\my documents\proj\resource.h(16) : warning C4005: 'IDC_STATIC' : macro redefinition
c:\program files\microsoft visual studio\vc98\mfc\include\afxres.h(290) : see previous definition of 'IDC_STATIC'

I cannot figure out which lines to remove. Tried to comment out line (16) but the problem persists.

Any help will be appreciated.



 
You need to right click on your controls in the dialog and give them unique names. IDC_STATIC is the default value. For example, right click on a static text field and go to properties... change IDC_STATIC to IDC_WELCOME_TEXT_STATIC.


Matt
 
But it is a dialog-less app..... I infact used the &quot;hello world&quot; template and commented the showwindow to hide it.
So where can I find the 'static field' you are referring to. Thanx
 
IT WORKED! Rather than find the dialog, what I did was change IDC_STATIC to IDC_STATIC1 in the &quot;resource.h&quot; file. Then I changed references to IDC_STATIC to IDC_STATIC1 in the resource file &quot;project.rc&quot;. Wala .... no more warnings.

But I am still surprised why this error occured. Is it because I added my code to the above mentioned files? Strange things happen when you mess with MS generated code.

Anyway, Matt thanx for the info. It tipped me into the right direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top