如何在vc ++ DLL中创建myclass数组? [英] How to create array of myclass in vc++ DLL?
本文介绍了如何在vc ++ DLL中创建myclass数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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
推荐答案
'^'
运算符仅适用于C ++ / CLI代码,因此您不能在纯C中使用它。你也不能在纯C中使用STL类。删除externC
行,看看你得到了什么。
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 theextern "C"
line and see what you get.
这篇关于如何在vc ++ DLL中创建myclass数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文