I am writing a mex file linking C code to matlab.
Here is my simple mex file which does not do anything and compiles fine.
#include "mex.h"
#ifndef N
#define N 100
#endif
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
/*validate input/output arguments */
}
But if I change the comment, like this:
#include "mex.h"
#ifndef N
#define N 100
#endif
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
//validate input/output arguments
}
then I get the following error:
>> mex mexcallingmatlab.c
Building with 'gcc'.
Warning: You are using gcc version '4.8.2'. The version of gcc is not supported. The version currently supported with MEX is '4.7.x'. For a list of currently supported
compilers see: http://www.mathworks.com/support/compilers/current_release.
Warning: You are using gcc version '4.8.2-19ubuntu1)'. The version of gcc is not supported. The version currently supported with MEX is '4.7.x'. For a list of currently
supported compilers see: http://www.mathworks.com/support/compilers/current_release.
Error using mex
/home/dkumar/Mex_Codes_DKU/Mex_C_Codes_DKU2/mexcallingmatlab.c: In function ‘mexFunction’:
/home/dkumar/Mex_Codes_DKU/Mex_C_Codes_DKU2/mexcallingmatlab.c:9:5: error: expected expression before ‘/’ token
// validate input/output arguments */
^
Also, if I save either of the file as C++ file, then it always compiles whether I use // or /* .... */.
Could someone please tell me why "//" is not working for commenting?