For the record, the definitions which lead to this problem are:
void* AFX_CDECL operator new(size_t nSize, LPCSTR lpszFileName, int nLine);
#define DEBUG_NEW new(THIS_FILE, __LINE__)
#define new DEBUG_NEW
so when you do 'new ManagedClass(...)'
it's actually doing 'new("C:\...", 1234) ManagedClass(...)', and you can't
use placement-new to instantiate managed objects.
Not that it matters particularly now you've got it working.
"David Hardek" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
In my App.cpp file I deleted the following
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
cleaned the projet and rebuilt and it worked, I then put
the lines back in and cleaned the project again and it
worked again, so i am not really sure what action resolved
my issue, but the problem is gone.
Just as a note I had done a clean and rebuild several
times including one before I removed the lines (just after
I read the posting on how to solve the issue).
-----Original Message-----
In MFC, debug mode, 'new' is #defined to be something
else.
Aren't macros wonderful?
You'll need to undef it before you can make a new managed
object.And then you may want to redefine it back again.
Try right-clicking over new and using the 'go to
definition' option to findthe evil.
"David Hardek" <dh*****@vocollect.com> wrote in message
news:00****************************@phx.gbl... I am trying to use "FolderBrowserDialog". I copied the
code out of the online help (VC++) and put it into a
file. I can compile this file, but when I try and use the class I get a a C3828 error (Placement arguements not
allowed when using managed classes ...). I looked at the online help and it looks like my code matches what it says.
The following is the line that is causing the grief, and I don't think I am using placemnt arguements in this line?
FolderBrowserDialogExampleForm *folderBrowseDialog = new
FolderBrowserDialogExampleForm();
My project was based on a Visual C++ application, not a
windows form application, but I did turn on the /clr
compiler option and I believe I have all the approrpriate #using included.
.