Filter löschen
Filter löschen

MEX compiler error - not able to compile mexfunction

2 Ansichten (letzte 30 Tage)
michaelborg
michaelborg am 13 Sep. 2012
When trying to compile fortran code with mex, the following errors appearing:
mexaddon.f(1): error #5149: Illegal character in statement label field [S]
SUBROUTINE mexFunction(nlhs,plhs,nrhs,prhs)
^
mexaddon.f(1): error #5149: Illegal character in statement label field [U]
SUBROUTINE mexFunction(nlhs,plhs,nrhs,prhs)
-^
mexaddon.f(1): error #5149: Illegal character in statement label field [B]
SUBROUTINE mexFunction(nlhs,plhs,nrhs,prhs)
--^
And this sort of error continues with all the letters of SUBROUTINE, as well as when using INTEGER and IMPLICIT NONE. I cannot seem to find the reason why this is happening. Does anyone have any advice?

Antworten (2)

James Tursa
James Tursa am 13 Sep. 2012
Bearbeitet: James Tursa am 13 Sep. 2012
Get rid of the /fixed option for the compiler (which forces a free format file to be compiled as fixed format ... I still don't know why TMW insists on having this option in the mexopts file) as follows:
1) Go to the mexopts directory. On my machine it is [matlabroot '\bin\win32\mexopts']
2) Edit the mexopts file(s) associated with your Fortran compiler (on my machine the files are intelf91msvs2005ops.bat and intelf91msvs2005engmatopts.bat)
3) Find the COMPFLAGS line and get rid of the /fixed option on that line. On my machine I typically make a copy of the line, REM the old one and delete the /fixed on the new one. That way I still have the original line documented in the bat file.
4) Rerun the "mex -setup" command at the prompt to get your newly edited mexopts files selected for future compiling.

Jan
Jan am 13 Sep. 2012
Bearbeitet: Jan am 13 Sep. 2012
The error message does not only tell, that the character is illegal, but also that it appears in a "statement label field". I assume you use the modern free-form syntax, but tell the compiler to apply the rules for the old fixed-form, which requires leading spaces for the line numbers.
You could try to rename the file from .f to .f90. I guess that your compiler has a corresponding input flag to enable the modern format style.
Btw, asking Google about "Illegal character in statement label field" would reveal the cause of the problem also. Therefore it is recommended to search in the net at first before asking a forum.

Kategorien

Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by