求教:vc2005中的类型定义问题

bigsir 2006-06-27 11:59:37
cli::array<int^,10>^ some_strings = gcnew cli::array<int^>(20);

1>g:\project\dlgtest\dlgtest\Form1.h(691) : error C2440: “初始化”: 无法从“cli::array<Type> ^”转换为“cli::array<Type,dimension> ^”
1> with
1> [
1> Type=System::Int32 ^
1> ]
1> 无法在不同秩的托管数组之间转换
...全文
408 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
蒋晟 2006-06-28
  • 打赏
  • 举报
回复
cli::array<int^,2>^
gcnew cli::array<int^>(20,10)
amandag 2006-06-28
  • 打赏
  • 举报
回复
up
bigsir 2006-06-28
  • 打赏
  • 举报
回复
serialPort.Read(some_strings,1,1);
1>g:\project\dlgtest\dlgtest\Form1.h(701) : error C2664: “int System::IO::Ports::SerialPort::Read(cli::array<Type,dimension> ^,int,int)”: 不能将参数 1 从“cli::array<Type,dimension> ^”转换为“cli::array<Type,dimension> ^”
1> with
1> [
1> Type=unsigned char,
1> dimension=1
1> ]
1> and
1> [
1> Type=System::Int32 ^,
1> dimension=10
1> ]
1> and
1> [
1> Type=unsigned char,
1> dimension=1
1> ]
1> 无法在不同秩的托管数组之间转换
bigsir 2006-06-28
  • 打赏
  • 举报
回复
谢谢,至少有人看了
我希望建一个10,20的二维数组

蒋晟 2006-06-28
  • 打赏
  • 举报
回复
你的代码自相矛盾,又没注释,不明白你想做什么
cli::array<int^,10>^是一个10维数组
gcnew cli::array<int^>(20)是大小为20的一尾数组
bigsir 2006-06-28
  • 打赏
  • 举报
回复
谢谢,结贴了,能告诉我那里能找到基本的教材么,我想好好学习一下他的语法结构。

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧