By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,089 Members | 1,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,089 IT Pros & Developers. It's quick & easy.

Compilation Error :placement arguments not allowed?

P: n/a
i have the following scenario

I've created MFC Application using Visual Studio 2003, then change the
project settings
to use Managed Extensions as follows:

1. Configuration Properties->General->use Managed Extension : Yes
2. C/C++->General->Debug Information Format : Program Database (/Zi)
3. C/C++->Code Generation->Enable Minimal Build : No
4. C/C++->Basic Run-Time Check : Default
then in the CMyClassDlg.cpp did the following:

#using <mscorlib.dll>
#using <System.dll>
using namespace System;
#using <System.Xml.dll>
#using <System.Data.dll>
and in the OnInitDialog() did :

XmlDocument *xmlDoc = new XmlDocument();
//Just this to try

and compile this error message appeared:

(105): error C3828: 'System::Xml::XmlDocument': placement arguments not
allowed while creating instances of managed classes

I dont know why this error generated ,though I did the same thing in my
ISAPI Filter DLL project and used XmlDocument
and SqlClient effectively.
why this happening in MFC application .
Any Idea? Regards.


Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Raed Sawalha" <ra**********@hotmail.com> wrote

and in the OnInitDialog() did :

XmlDocument *xmlDoc = new XmlDocument();
//Just this to try

and compile this error message appeared:

(105): error C3828: 'System::Xml::XmlDocument': placement arguments not
allowed while creating instances of managed classes

This might due to some magic MFC applies to trace memory leaks.
In debug builds MFC used to redefine new to call a placement
version of the operator ( e.g.: new (__FILE__,__LINE__) XmlDocument ).

Placement syntax is not supported for managed objects.

Can you try to build in release mode or #undef new after the MFC
header #includes?
I'm not sure there is a good way to use MFC memory checks along
with managed functionality. Maybe you want to write a template
function to create GC objects.

-hg
Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.