MATLAB: Problem compiling mex files using visual studio.

mex compilationvisual studio

I'm currently using a patch to compile mex files using visual studio 2010 ( http://www.mathworks.com/support/solutions/en/data/1-D5W493/?solution=1-D5W493).
I was able to compile many files but I am having trouble trying to compile an implementation of a decision tree ( http://www.cs.uiuc.edu/homes/dhoiem/software/counter.php?Down=boostDt.zip)
The errors that the mex compiler is giving to me do not make any sense. Does someone had any problem like that?
>> mex treevalc.c
treevalc.c
treevalc.c(26) : warning C4101: 'cid' : unreferenced local variable
treevalc.c(92) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(93) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(94) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(95) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(97) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(98) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(99) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(101) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(102) : error C2065: 'n' : undeclared identifier
treevalc.c(102) : error C2065: 'n' : undeclared identifier
treevalc.c(102) : error C2065: 'nsplits' : undeclared identifier
treevalc.c(102) : error C2065: 'n' : undeclared identifier
treevalc.c(103) : error C2065: 'n' : undeclared identifier
treevalc.c(107) : error C2065: 'ncatsplit' : undeclared identifier
treevalc.c(107) : error C2065: 'n' : undeclared identifier
treevalc.c(107) : error C2109: subscript requires array or pointer type
treevalc.c(108) : error C2065: 'catsplit' : undeclared identifier
treevalc.c(108) : error C2065: 'n' : undeclared identifier
treevalc.c(108) : error C2109: subscript requires array or pointer type
treevalc.c(111) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(112) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(116) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(118) : error C2065: 'numdata' : undeclared identifier
treevalc.c(119) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(122) : error C2143: syntax error : missing ';' before 'type'
treevalc.c(123) : error C2065: 'n' : undeclared identifier
treevalc.c(123) : error C2065: 'n' : undeclared identifier
treevalc.c(123) : error C2065: 'numdata' : undeclared identifier
treevalc.c(123) : error C2065: 'n' : undeclared identifier
treevalc.c(124) : error C2065: 'var' : undeclared identifier
treevalc.c(124) : warning C4047: 'function' : 'int *' differs in levels of indirection from 'int'
treevalc.c(124) : warning C4024: 'treevalc' : different types for formal and actual parameter 1
treevalc.c(124) : error C2065: 'cut' : undeclared identifier
treevalc.c(124) : warning C4047: 'function' : 'double *' differs in levels of indirection from 'int'
treevalc.c(124) : warning C4024: 'treevalc' : different types for formal and actual parameter 2
treevalc.c(124) : error C2065: 'left_child' : undeclared identifier
treevalc.c(124) : warning C4047: 'function' : 'int *' differs in levels of indirection from 'int'
treevalc.c(124) : warning C4024: 'treevalc' : different types for formal and actual parameter 3
treevalc.c(124) : error C2065: 'right_child' : undeclared identifier
treevalc.c(124) : warning C4047: 'function' : 'int *' differs in levels of indirection from 'int'
treevalc.c(124) : warning C4024: 'treevalc' : different types for formal and actual parameter 4
treevalc.c(124) : error C2065: 'ncatsplit' : undeclared identifier
treevalc.c(124) : warning C4047: 'function' : 'int *' differs in levels of indirection from 'int'
treevalc.c(124) : warning C4024: 'treevalc' : different types for formal and actual parameter 5
treevalc.c(124) : error C2065: 'catsplit' : undeclared identifier
treevalc.c(124) : warning C4047: 'function' : 'double **' differs in levels of indirection from 'int'
treevalc.c(124) : warning C4024: 'treevalc' : different types for formal and actual parameter 6
treevalc.c(125) : error C2065: 'all_attributes' : undeclared identifier
treevalc.c(125) : error C2065: 'numatt' : undeclared identifier
treevalc.c(125) : error C2065: 'n' : undeclared identifier
treevalc.c(125) : error C2109: subscript requires array or pointer type
treevalc.c(125) : error C2065: 'tmp_id' : undeclared identifier
treevalc.c(125) : warning C4133: 'function' : incompatible types - from 'int *' to 'double *'
treevalc.c(125) : error C2198: 'treevalc' : too few arguments for call
treevalc.c(126) : error C2065: 'node_ids' : undeclared identifier
treevalc.c(126) : error C2065: 'n' : undeclared identifier
treevalc.c(126) : error C2109: subscript requires array or pointer type
treevalc.c(126) : error C2065: 'tmp_id' : undeclared identifier
treevalc.c(130) : error C2065: 'catsplit' : undeclared identifier
treevalc.c(130) : warning C4022: 'free' : pointer mismatch for actual parameter 1
treevalc.c(131) : error C2065: 'ncatsplit' : undeclared identifier
treevalc.c(131) : warning C4022: 'free' : pointer mismatch for actual parameter 1
C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Compile of 'treevalc.c' failed.

Best Answer

Found the solution. The mex compiler was using a restrict C compiler, so I could not create variable in the middle of the function. Thx for the effort guys.
Related Question