Bonjour à tous,
Mon objectif est d'appeler une fonction écrite en fortran dans matlab.
Pour cela je dispose de 2 fichiers pour ma fonction en fortran: ACM552.FOR et ACM552G.FOR (c'est la Gateway Routine), de matlab 7.5 (R2007b) et d'un compilateur fortran: Intel visual fortran 9.1 (j'utilise ce compilateur car il est compatible avec matlab 7.5 d'apres ce site: http://matlab.developpez.com/faq/?pa...pilateur_liste).
Je ne connais pas grand chose aux compilateurs et aux fichiers mex mais voici la procédure que j'ai suivis pour essayer de créer un fichier mex qui puisse etre appeler par matlab:
1) j'ai tapé: mex -setup
2) il me propose d'utiliser un compilateur déjà installer j'ai dit "n" pour NON
3) il me propose une liste de compilateur dont le "Intel visual fortran 9.1", je choisi donc dans la liste le numéro qui convient pour prendre mon compilateur
4) Jusque là tous se passe correctement car il ne montre pas de message d'erreurs
5) je veux créer un fichier mex pour pouvoir utliser ma fonction (qui se trouve sur mon bureau) donc je tape: mex -v "D:\Documents and Settings\....\ACM552G.FOR" "D:\Documents and Settings\...\ACM552.FOR"
Est la j'ai un message d'erreur dont la conséquence directe est une non création de mon ficheir mex!
Voici l'erreur (qui apparait dans le bas du code ci dessous):
This is mex, Copyright 1984-2006 The MathWorks, Inc.
-> Default options filename found in D:\Documents and Settings\Bolivar\Application Data\MathWorks\MATLAB\R2007b
----------------------------------------------------------------
-> Options file = D:\Documents and Settings\Bolivar\Application Data\MathWorks\MATLAB\R2007b\mexopts.bat
MATLAB = D:\PROGRA~1\MATLAB\R2007b
-> COMPILER = ifort
-> Compiler flags:
COMPFLAGS = /fpp /Qprec "/ID:\PROGRA~1\MATLAB\R2007b/extern/include" -c -nologo -DMATLAB_MEX_FILE /fixed /fp:precise
OPTIMFLAGS = /MD -Ox -DNDEBUG
DEBUGFLAGS = /MD -Zi /PDB:"ACM552G.mexw32.pdb"
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /DLL /EXPORT:MEXFUNCTION /MAP /LIBPATH:"D:\PROGRA~1\MATLAB\R2007b\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib /implib:\DOCUME~1\Bolivar\LOCALS~1\Temp\mex_7F7156DA-AAE4-40C9-4E93-6C0B78A1C701\templib.lib /NOLOGO
LINKDEBUGFLAGS = /debug /PDB:"ACM552G.mexw32.pdb"
LINKFLAGSPOST =
Name directive = "/out:ACM552G.mexw32"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> "ifort /fpp /Qprec "/ID:\PROGRA~1\MATLAB\R2007b/extern/include" -c -nologo -DMATLAB_MEX_FILE /fixed /fp:precise /FoD:\DOCUME~1\Bolivar\LOCALS~1\Temp\mex_7F7156DA-AAE4-40C9-4E93-6C0B78A1C701\ACM552G.obj /MD -Ox -DNDEBUG -DMX_COMPAT_32 "D:\Documents and Settings\Bolivar\Bureau\test de Algo LNE HIchem Nouira\Tchebychef\disk 1\MZ_CON\ACM552G.FOR""
ifort: Command line warning: /fp:precise evaluates in source precision with Fortran.
--> "ifort /fpp /Qprec "/ID:\PROGRA~1\MATLAB\R2007b/extern/include" -c -nologo -DMATLAB_MEX_FILE /fixed /fp:precise /FoD:\DOCUME~1\Bolivar\LOCALS~1\Temp\mex_7F7156DA-AAE4-40C9-4E93-6C0B78A1C701\ACM552.obj /MD -Ox -DNDEBUG -DMX_COMPAT_32 "D:\Documents and Settings\Bolivar\Bureau\test de Algo LNE HIchem Nouira\Tchebychef\disk 1\MZ_CON\ACM552.FOR""
ifort: Command line warning: /fp:precise evaluates in source precision with Fortran.
Contents of D:\DOCUME~1\Bolivar\LOCALS~1\Temp\mex_7F7156DA-AAE4-40C9-4E93-6C0B78A1C701\mex_tmp.rsp:
D:\DOCUME~1\Bolivar\LOCALS~1\Temp\mex_7F7156DA-AAE4-40C9-4E93-6C0B78A1C701\ACM552G.obj D:\DOCUME~1\Bolivar\LOCALS~1\Temp\mex_7F7156DA-AAE4-40C9-4E93-6C0B78A1C701\ACM552.obj
--> "link "/out:ACM552G.mexw32" /DLL /EXPORT:MEXFUNCTION /MAP /LIBPATH:"D:\PROGRA~1\MATLAB\R2007b\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib /implib:\DOCUME~1\Bolivar\LOCALS~1\Temp\mex_7F7156DA-AAE4-40C9-4E93-6C0B78A1C701\templib.lib /NOLOGO @D:\DOCUME~1\Bolivar\LOCALS~1\Temp\mex_7F7156DA-AAE4-40C9-4E93-6C0B78A1C701\mex_tmp.rsp "
LINK : error LNK2001: unresolved external symbol MEXFUNCTION
D:\DOCUME~1\Bolivar\LOCALS~1\Temp\mex_7F7156DA-AAE4-40C9-4E93-6C0B78A1C701\templib.lib : fatal error LNK1120: 1 unresolved externals
D:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Link of 'ACM552G.mexw32' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
Quelqu'un à -t-il une idée d'ou peu bien provenir cette erreur?? Comment puis je régler cela?? Merci pour vos réponses.
Partager