我需要将C#代码转换为C++,尽管没有一次没有移动C++,只从不同的部分组合,看起来如何,然后以某种方式工作。我现在主要有一个数组给我一个错误作为主题的问题。数组“表达式必须有一个常量”
public:
int arrimg(Bitmap^ image)
{
const int w = image->Width;
const int h = image->Height;
const int z = 3;
int dtab[w][h][z];
for (int x = 0; x < image->Width; x++)
{
for (int y = 0; y < image->Height; y++)
{
dtab[x][ y][ 0] = image->GetPixel(x, y).R;
dtab[x][ y][ 1] = image->GetPixel(x, y).G;
dtab[x][ y][ 2] = image->GetPixel(x, y).B;
}
}
return dtab;
}
错误仍然“在”和“h”弹出了我不知道如何解决它。第二个问题,如果我给严格的“一”和“h”也是数字“DTAB”崩溃的错误,“Rerturn类型不匹配的功能类型。
'int arrimg(Bitmap^image)'not C++。也许C++ - cli。 – drescherjm
1.数组大小应当编译时间常数 2.你返回一个int [] [] []不是int – UKMonkey
@drescherjm JUP,这是C++/CLI – Rakete1111