SDK vs gcc编译器
5视图(30天)
显示旧的评论
我有一个例子,我想创建一个向量双打的大小由一个变量传递给一个函数在一个墨西哥人函数(双V[],然后填写使用一个循环)。代码被编译并与gcc编译器是否按预期运行在linux机器。然而,当我试着编译代码在32位windows机器上使用SDK编译器行双V[]会导致一些错误。
这是代码:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / / # include
matrix.h
# include
mex.h
空白comp_routine(双c [], const int) {int我;双V (s - 1);/ /这条线不会引起麻烦gcc编译器/ /双V [10];(我= 0;< s;我+ +){V[我]=我;}
为(我= 0;<年代;我+ +){
[我]c[我]= V =我;
}
返回;
}
空白mexFunction (int nlhs mxArray
*
plhs [], int nrhs const mxArray * prhs []) {
/ /声明变量
mxArray* a_in_m* c_out_m;
双*一个* c;
/ /将输入a_in_m = mxDuplicateArray (prhs [0]);
/ /指针= mxGetPr关联(a_in_m);int s = (int) [0];
/ /关联输出
c_out_m = plhs [0] = mxCreateDoubleMatrix(年代,1,mxREAL);
c = mxGetPr (c_out_m);
comp_routine (c, s);
返回;
}
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
这是我收到的错误:
> >墨西哥人sdk_vs_gcc。cpp sdk_vs_gcc。cpp sdk_vs_gcc.cpp(6):错误C2057:预期常数表达式sdk_vs_gcc.cpp(6):错误C2466:不能分配常数大小的数组0 sdk_vs_gcc.cpp(6):错误C2133:“V”:未知的大小
MATLAB C: \ PROGRA ~ 1 \ \ R2013A \ BIN \墨西哥人。PL:错误:编译的“sdk_vs_gcc。cpp的失败。
谢谢你的帮助!