フィルターのクリア

MEX compiler error - not able to compile mexfunction

2 ビュー (過去 30 日間)
michaelborg
michaelborg 2012 年 9 月 13 日
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?

回答 (2 件)

James Tursa
James Tursa 2012 年 9 月 13 日
編集済み: James Tursa 2012 年 9 月 13 日
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 2012 年 9 月 13 日
編集済み: Jan 2012 年 9 月 13 日
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.

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by