Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
In a VC++ 2015, win32 project(dll) - (in extern "C" block)
How do I create a array of myClass?

mycode is this:

    MyClass c;
    		c.ID = 1;
    		c.MyAccount = 3;
    		c.Name = L"wewerwe";    
    array<myclass>^ aiArray;
        		aiArray = gcnew array<myclass>(5);
        		aiArray[0] = c;

this code has errors: 

    error C3699: '^': cannot use this indirection on type 'std::array'
    error C2027: use of undefined type 'std::array'

What I have tried:

to create an arrary of MyClass objects in my vc++ dll project
Posted
Updated 22-Jan-18 22:04pm

1 solution

The '^' operator is only available in C++/CLI code, so you cannot use it in pure C. And you cannot use STL classes in pure C either. Remove the extern "C" line and see what you get.
 
Share this answer
 
Comments
Zon-cpp 23-Jan-18 8:54am    
How do I create array of MyClass objects in a pure C (for extern "C")?
Richard MacCutchan 23-Jan-18 9:13am    
You don't. C is a purely procedural language, it does not have classes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900