Prev: xpc shared interrupts
Next: ODE15s, ODE23s
From: andrea on 15 Feb 2010 09:25 Hi, when I convert my .c file in a .mex file I have these errors: Error treevalc.c: 92 illegal statement termination Error treevalc.c: 92 skipping `int' Error treevalc.c: 92 undeclared identifier `var' Error treevalc.c: 92 type error: pointer expected Error treevalc.c: 92 operands of = have illegal types `int' and `pointer to int' The command line 92 is as follows: int* var = (int*)mxGetPr(prhs[0]); What should I change? Thanks in advance Andrea
From: Jan Simon on 15 Feb 2010 10:19 Dear Andrea! > Error treevalc.c: 92 illegal statement termination > Error treevalc.c: 92 skipping `int' > Error treevalc.c: 92 undeclared identifier `var' > Error treevalc.c: 92 type error: pointer expected > Error treevalc.c: 92 operands of = have illegal types `int' and `pointer to int' > > The command line 92 is as follows: > int* var = (int*)mxGetPr(prhs[0]); There is no error in this line. Please look in the line 91. Kind regards, Jan
From: andrea on 16 Feb 2010 03:36 This is the code of my function, the errors that I have are in the last four rows void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { if (nrhs != 6) { printf("Error: wrong number of input arguments: %d.\n", nlhs); printf("Syntax: node_ids = treevalc(var, cut, left_child, right_child, catsplit, attributes)\n"); } int* var = (int*)mxGetPr(prhs[0]); double* cut = mxGetPr(prhs[1]); int* left_child = (int*)mxGetPr(prhs[2]); int* right_child = (int*)mxGetPr(prhs[3]); Maybe the errors are caused by the fact that I use Windows and the code has been written for Linux? Andrea "andrea " <nacchio1983(a)yahoo.it> wrote in message <hlblg0$q7u$1(a)fred.mathworks.com>... > Hi, > > when I convert my .c file in a .mex file I have these errors: > > Error treevalc.c: 92 illegal statement termination > Error treevalc.c: 92 skipping `int' > Error treevalc.c: 92 undeclared identifier `var' > Error treevalc.c: 92 type error: pointer expected > Error treevalc.c: 92 operands of = have illegal types `int' and `pointer to int' > > The command line 92 is as follows: > > int* var = (int*)mxGetPr(prhs[0]); > > What should I change? > > > Thanks in advance > > Andrea
From: andrea on 16 Feb 2010 03:45 I discovered that the problem is the IF but I do not know why Andrea "andrea " <nacchio1983(a)yahoo.it> wrote in message <hlblg0$q7u$1(a)fred.mathworks.com>... > Hi, > > when I convert my .c file in a .mex file I have these errors: > > Error treevalc.c: 92 illegal statement termination > Error treevalc.c: 92 skipping `int' > Error treevalc.c: 92 undeclared identifier `var' > Error treevalc.c: 92 type error: pointer expected > Error treevalc.c: 92 operands of = have illegal types `int' and `pointer to int' > > The command line 92 is as follows: > > int* var = (int*)mxGetPr(prhs[0]); > > What should I change? > > > Thanks in advance > > Andrea
From: Steve Amphlett on 16 Feb 2010 03:55
"andrea " <nacchio1983(a)yahoo.it> wrote in message <hldlv4$jnk$1(a)fred.mathworks.com>... > I discovered that the problem is the IF but I do not know why > > Andrea > > > > "andrea " <nacchio1983(a)yahoo.it> wrote in message <hlblg0$q7u$1(a)fred.mathworks.com>... > > Hi, > > > > when I convert my .c file in a .mex file I have these errors: > > > > Error treevalc.c: 92 illegal statement termination > > Error treevalc.c: 92 skipping `int' > > Error treevalc.c: 92 undeclared identifier `var' > > Error treevalc.c: 92 type error: pointer expected > > Error treevalc.c: 92 operands of = have illegal types `int' and `pointer to int' > > > > The command line 92 is as follows: > > > > int* var = (int*)mxGetPr(prhs[0]); > > > > What should I change? > > > > > > Thanks in advance > > > > Andrea If this is C code, declaring new variables in the body of a code block is illegal. They must be declared at the top of the block only. C++ relaxes this rule. Your compiler may be using strict C rules. |