RSS
Follow Us
Contribute
 
 
 
 

Error C2728: (type) : a native array cannot contain this managed type

 
We need YOUR SKILLS in this collaborative work, to build the largest solution center for error messages.

From $1

Table of contents
  1. 1. Cause
  2. 2. Solution
  3. 3. (ToDo)
  4. 4. About This Article

Cause

Array creation syntax was used to create an array of managed objects. You cannot create an array of managed objects using native array syntax. Ex:

// compile with: /clr

int main() {
   int^ arr[5];   // C2728
}

Solution

Possible resolution:

// compile with: /clr

int main() {
   array<int>^arr2;
}

(ToDo)

Give some more code examples that may trigger this error.

About This Article

This article is a derivative work based on Compiler Error C2728 which is provided by MSDN Community Content - Visual C++.

 
 
 
 
Comments