[Insight-users] Trouble with #ifdef _DEBUG in VC6
Li, George (NIH/NCI)
ligeorge at mail.nih.gov
Tue Nov 30 15:20:37 EST 2004
Dear Insight users:
In most VC6 generated *.cpp code, there is a set of micro
statements that are useful to detect memory leak:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
After combined with ITK, the compiler start to complain "new"
related issues. Some compiling error messages are listed below:
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2061:
syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2091:
function returns function
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2809:
'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\new(36) : error C2061:
syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2091:
function returns function
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2556:
'void *(__cdecl *__cdecl operator new(void))(unsigned int,const struct
std::nothrow_t &)' : overloaded function differs only by return type from
'void *(__cdecl *__cdecl operator new(void))(unsigned int)'
c:\program files\microsoft visual studio\vc98\include\new(35) : see
declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\new(41) : error C2061:
syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2091:
function returns function
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2556:
'void *(__cdecl *__cdecl operator new(void))(unsigned int,void *)' :
overloaded function differs only by return type from 'void *(__cdecl
*__cdecl operator new(void))(unsigned int)'
My temporary solution is to quote these micros out. However, it
would be nice to leave the MFC stuff intact, as they are useful for
debugging purpose.
My test code is simply a MFC generated simple MDI application
in which I use a Manu selection (an item in the pull down Manu)
to trigger one of the ITK example for image registration. In the VC6
Project Settings, I included the necessary source code in C/C++,
libs in Link, and so on. May be I still miss something else for a
proper project setting.
Any suggestions for me to get around this problem?
Thanks,
George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20041130/fcbec599/attachment.htm
More information about the Insight-users
mailing list