I want to compile a C code in ubuntu using mex
which is configured with gcc. I can smoothly compile the code in OSX. However, when I want to compile it in Linux, the compiler generates the error on the comment lines starting with //
(it works fine with /* */
. Since the program includes several header files from third-party libraries, I cannot substitute //
with /* */
.
I would like to know whether there is any way around to overcome this problem.
MATLAB version: R2012b gcc version in Linux: 4.7.2 gcc version in OSX: 4.2.1
Any help is appreciated
Edit: Here is the command I use to compile the code:
mex -g -largeArrayDims -ldl TDSVDHNGateway.c
Here is the error generated by mex:
In file included from TDSVDHNGateway.c:2:0:
TDS.h:17:1: error: expected identifier or ‘(’ before ‘/’ token
TDS.h:26:2: error: unknown type name ‘index_t’
TDS.h:27:2: error: unknown type name ‘index_t’
In file included from TDSVDHNGateway.c:2:0:
TDS.h:146:3: error: unknown type name ‘index_t’
TDSVDHNGateway.c:37:3: error: unknown type name ‘index_t’
TDSVDHNGateway.c: In function ‘mexFunction’:
TDSVDHNGateway.c:166:25: error: ‘index_t’ undeclared (first use in this function)
TDSVDHNGateway.c:166:25: note: each undeclared identifier is reported only once for each function it appears in
Line 17 in header file is:
//Defining index_t
typedef size_t index_t;
If I replace //Defining index_t
with /*Defining index_t*/
the code will be compiled with no problem.