How to debug the" illegal statement termination" ?

13 ビュー (過去 30 日間)
wenjie
wenjie 2014 年 6 月 24 日
コメント済み: José-Luis 2014 年 6 月 24 日
I install the c++ compiler successfully.
But the program appear a error.
Could you tell me how to debug the program?
>> make Error atoi.cpp: 20 illegal statement termination Error atoi.cpp: 20 skipping `int' Error atoi.cpp: 20 undeclared identifier `i' 3 errors, 0 warnings
D:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'atoi.cpp' failed.
Error using mex (line 206) Unable to complete successfully.
Error in make (line 5)
mex atoi.cpp;
  2 件のコメント
wenjie
wenjie 2014 年 6 月 24 日
編集済み: wenjie 2014 年 6 月 24 日
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
// a
char a[MAX_LEN];
mxGetString(prhs[0], a, MAX_LEN);
// main parts
int i = atoi(a);
// i
plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
*mxGetPr(plhs[0]) = i;
}
José-Luis
José-Luis 2014 年 6 月 24 日
Could you show the offending line? Also, if you are trying the mex the standard atoi function, you would normally not compile the .cpp file, only the c header "stdlib.h".

サインインしてコメントする。

回答 (1 件)

dpb
dpb 2014 年 6 月 24 日
>> make Error atoi.cpp: 20 illegal statement termination
Error atoi.cpp: 20 skipping `int'
Error atoi.cpp: 20 undeclared identifier `i'
3 errors, 0 warnings
There's a problem in the .cpp file that the line 20 is malformed--perhaps there's some embedded nonprinting characters or somesuch.
Are you certain you're looking at the copy of the file actually submitted to the compiler?

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by