M
Michael Bray
Question from a co-worker braving Managed C++ (I only do C#):
I’m having trouble including an ArrayList in a MFC application. My
intention is to call some C# DLLs from a VC++ extended stored procedure.
So, I thought I’d test in a simple dialog box application where its
easier to debug.
I created a Visual C++ Project -> MFC Application -> dialog interface
I added the following line in the OnBnClickedOk() method
ArrayList* myAL = new ArrayList();
I added the following three lines after the #pragma in the TestDlg.h
file
#using <mscorlib.dll>
using namespace System;
using namespace System::Collections;
Compilation yielded the following error
fatal error C1190: managed targeted code requires '#using
<mscorlib.dll>' and '/clr' option
I added the /clr option to the Property Page -> Configuration Properties
-> C/C++ -> Command Line -> Additional Options section
Command line error D2016 : '/RTC1' and '/clr' command-line options are
incompatible
I changed Both to Default in the Property Page -> Configuration
Properties -> C/C++ -> Code Generation -> Basic Runtime Checks section
Command line error D2016 : '/Gm' and '/clr' command-line options are
incompatible
I changed Yes to No in the Property Page -> Configuration Properties ->
C/C++ -> Code Generation -> Enable Minimal Rebuild section
Command line error D2016 : '/ZI' and '/clr' command-line options are
incompatible
I changed Program Database for Edit & Continue to Program Database in
the Property Page -> Configuration Properties -> C/C++ -> General ->
Debug Information Format section
error C3828: 'System::Collections::ArrayList': placement arguments not
allowed while creating instances of managed classes
The error occurs in the ArrayList variable definition, in particular the
new ArrayList() portion.
Thanks!
-mdb
I’m having trouble including an ArrayList in a MFC application. My
intention is to call some C# DLLs from a VC++ extended stored procedure.
So, I thought I’d test in a simple dialog box application where its
easier to debug.
I created a Visual C++ Project -> MFC Application -> dialog interface
I added the following line in the OnBnClickedOk() method
ArrayList* myAL = new ArrayList();
I added the following three lines after the #pragma in the TestDlg.h
file
#using <mscorlib.dll>
using namespace System;
using namespace System::Collections;
Compilation yielded the following error
fatal error C1190: managed targeted code requires '#using
<mscorlib.dll>' and '/clr' option
I added the /clr option to the Property Page -> Configuration Properties
-> C/C++ -> Command Line -> Additional Options section
Command line error D2016 : '/RTC1' and '/clr' command-line options are
incompatible
I changed Both to Default in the Property Page -> Configuration
Properties -> C/C++ -> Code Generation -> Basic Runtime Checks section
Command line error D2016 : '/Gm' and '/clr' command-line options are
incompatible
I changed Yes to No in the Property Page -> Configuration Properties ->
C/C++ -> Code Generation -> Enable Minimal Rebuild section
Command line error D2016 : '/ZI' and '/clr' command-line options are
incompatible
I changed Program Database for Edit & Continue to Program Database in
the Property Page -> Configuration Properties -> C/C++ -> General ->
Debug Information Format section
error C3828: 'System::Collections::ArrayList': placement arguments not
allowed while creating instances of managed classes
The error occurs in the ArrayList variable definition, in particular the
new ArrayList() portion.
Thanks!
-mdb