Я пишу файл mex, связывающий код C с Matlab.
Вот мой простой mex-файл, который ничего не делает и отлично компилируется.
#include "mex.h"
#ifndef N
#define N 100
#endif
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
/*validate input/output arguments */
}
Но если я изменю комментарий, вот так:
#include "mex.h"
#ifndef N
#define N 100
#endif
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
//validate input/output arguments
}
то я получаю следующую ошибку:
>> 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 */
^
Кроме того, если я сохраняю какой-либо файл как файл C++, он всегда компилируется независимо от того, использую ли я // или /* .... */.
Может кто-нибудь сказать мне, почему "//" не работает для комментариев?