MATLAB gives error while generating MEX file from the Fortran source code
Show older comments
When I try to generate the MEX file from the Fortran source code (TEINITG.F), Matlab always gives errors.After downloading the trial versions of Intel Visual Fortran 11.1 Microsoft Visual C++ 2008 SP1 linker, I used mex -setup to configure the environment. Then I tried to generate mex functions from FORTRAN Source Code (TEINITG.F).
However, when I type: mex TEINITG.F
Matlab shows link errors, like: >>mex TEINITG.F Creating library C:\Users\xue\AppData\Local\Temp\mex_TDkmp3\templib.x and object C:\Users\xue\AppData\Local\Temp\mex_TDkmp3\templib.exp TEINITG.obj : error LNK2019: unresolved external symbol _TEINIT referenced in function _MEXFUNCTION TEINITG.mexw32 : fatal error LNK1120: 1 unresolved externals
C:\PROGRA~2\MATLAB\R2010B~1\BIN\MEX.PL: Error: Link of 'TEINITG.mexw32' failed.
I am running MATLAB R2010b-32bit on windows-64 bit. Might that be the source of problem? I do not know how to deal with this error. Do you have any suggestions that may fix this problem?
2 Comments
Walter Roberson
on 26 Dec 2012
You have a source file TEINITG.F . Inside that, is the routine named TEINIT with no G ? If so that could be a problem.
Accepted Answer
More Answers (1)
Jan
on 26 Dec 2012
0 votes
Is TEINITG the name of a defined function? The compiler claimes, that it is not: "unresolved external symbol _TEINITG" means, that there is no such function.
You cannot use the name of the source file to call your function from the inside, because this works from Matlab only. From inside the MEXFUNCTION a recursive call has to call MEXFUNCTION.
Categories
Find more on Fortran with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!