Microsoft KB Archive/95198

= PRB: C2061 Error Generated When DEBUG_NEW Used in Application =

Article ID: 95198

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft C/C++ Professional Development System 7.0

 Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 1.5 Professional Edition

 Microsoft Visual C++ 1.51</li></ul>

 Microsoft Visual C++ 1.52 Professional Edition</li></ul>

 Microsoft Visual C++ 1.0 Professional Edition</li></ul>

 Microsoft Visual C++ 2.0 Professional Edition</li></ul>

 Microsoft Visual C++ 2.1</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q95198

<div class="notice_section">

<div class="symptoms_section">

SYMPTOMS
An attempt to compile an application that changes the definition of the &quot;new&quot; operator to DEBUG_NEW fails and the compiler generates the following message:

error C2061: syntax error : identifier 'p'

<div class="cause_section">

CAUSE
The statement &quot;#define new DEBUG_NEW&quot; precedes an IMPLEMENT_SERIAL or an IMPLEMENT_DYNACREATE macro call.

<div class="resolution_section">

RESOLUTION
Modify the source code to place the DEBUG_NEW definition after all statements that call the IMPLEMENT_SERIAL or IMPLEMENT_DYNCREATE macros. For more information, see Chapter 15 of the Microsoft Visual C++ &quot;Class Library User's Guide.&quot;

<div class="moreinformation_section">

MORE INFORMATION
This behavior has changed for Visual C++ version 4.0. However, if you build an application that makes use of DEBUG_NEW with Visual C++ 4.0, and then attempt to build that application in Visual C++ version 2.x, you will need to move the #define DEBUG_NEW as discussed above.

Additional query words: 1.00 1.50 2.00 2.10 2.50 2.51 2.52 3.00 3.10 7.00

Keywords: kbbug kbdebug kbprb KB95198

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.