Compile C file with mex in Linux with higher version of gcc
Afficher commentaires plus anciens
I installed MATLAB R2012a in Fedora 18 whose gcc version is 4.7.1. When I tried to compile c file using mex, it warned me it only supported 4.6.6. I tried to continue. It gave:
test.c:3:6: error: conflicting types for ‘mexFunction’ In file included from test.c:2:0: /usr/local/MATLAB/R2012b/extern/include/mex.h:145:6: note: previous declaration of ‘mexFunction’ was here
mex: compile of ' "test.c"' failed.
When I change the mexFunction to mexF, test.c could be compiled. However, test could not be executed due to loss of entry points. I downloaded gcc4.6.6 and corresponding gmp, mpfr and tried many configure options to install gcc. However, different options just generated different errors. Is there any other way?
1 commentaire
Kaustubha Govind
le 29 Jan 2013
What is the prototype of mexFunction in test.c? From the error, it seems that it doesn't match the standard expected prototype:
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Réponses (1)
Jan
le 29 Jan 2013
0 votes
Yes, there must be another way. Installing GCC4.6.6 should work, but obviously not by one of the "many configure options" you have tried so far. I'm convinced that somebody can assist you with installing the compiler, if you explain "different options generated different errors" with all required details.
Catégories
En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!