Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Warning C4368
Collapse the table of content
Expand the table of content

Compiler Warning C4368

Error Message

cannot define 'member' as a member of managed 'type': mixed types are not supported

You cannot embed a native data member in a CLR type.

You can, however, declare a pointer to a native type and control its lifetime in the constructor and destructor and finalizer of your managed class (see Destructors and Finalizers in Visual C++ for more information).

This warning is always issued as an error. Use the warning pragma to disable C4368.

Example

The following sample generates C4368.

// C4368.cpp
// compile with: /clr /c
struct N {};
ref struct O {};
ref struct R {
    R() : m_p( new N ) {}
    ~R() { delete m_p; }

   property N prop;   // C4368
   int i[10];   // C4368

   property O ^ prop2;   // OK
   N * m_p;   // OK
};

Community Additions

ADD
Show:
© 2015 Microsoft