I am trying to compile a Fortran file with an external precompiled module. First I compile the module file with:
ifort /c KDTree_mod.f90
it generates some .mod files (kdtree2_module.mod, kdtree2_precision_module.mod, kdtree2_priority_queue_module.mod).
At the beginning of the subroutine I have:
subroutine film(h,tinf,ts,n,time)
use kdtree2_module
but when I launch the program it gives me this error:
user_film.obj : error LNK2019: unresolved external symbol KDTREE2_MODULE_mp_KDTREE2_CREATE referenced in function FILM
user_film.obj : error LNK2019: unresolved external symbol KDTREE2_MODULE_mp_KDTREE2_N_NEAREST referenced in function FILM
user_film.exe : fatal error LNK1120: 2 unresolved externals
link failed for user_film.obj
Procedure:
1. compile the module with ifort /c KDTree_mod.f90
2. launch MSC Marc with user subroutine film.run_marc -j name_input_file -u user_subroutine
3. Error
MSC Marc is a commercial software that has the possibility to create user subroutine.
Update:
I tried:
1. ifort /c KDTree_mod.f90 --> generate .obj filerun_marc -j name_input_file -obj name_obj.obj -u name_input_file
It compiles fine but suddenly error:
forrtl: severe (170): Program Exception - stack overflow Image
PC Routine Line Sourceuser_film.exe 0000000141D63717 Unknown Unknown Unknown user_film.exe 000000013FD45C96 Unknown
Unknown Unknown user_film.exe 000000013FF1CCC7 Unknown
Unknown Unknown user_film.exe 000000013FD9495E Unknown
Unknown Unknown user_film.exe 00000001405A819A Unknown
Unknown Unknown user_film.exe 0000000140236B11 Unknown
Unknown Unknown user_film.exe 000000013FFE32DB Unknown
Unknown Unknown user_film.exe 000000013FFEE6C1 Unknown
Unknown Unknown user_film.exe 000000013FE70FAE Unknown
Unknown Unknown user_film.exe 000000013FD51592 Unknown
Unknown Unknown user_film.exe 000000013FD4105D Unknown
Unknown Unknown user_film.exe 00000001424CE3DC Unknown
Unknown Unknown user_film.exe 0000000141D638B2 Unknown
Unknown Unknown kernel32.dll 0000000077475A4D Unknown
Unknown Unknown ntdll.dll 00000000775AB831 Unknown
Unknown Unknown
ifort /c KDTree_mod.f90 ifort /c user_film.f run_marc -j name_input_file -obj KDtree_mod.obj user_film.obj
read error: no such option: user_film.obj or input value: -b
So seems that I am not able to pass both .obj files.ifort /c KDTree_mod.f90 ifort /c user_film.f KDTree_mod.obj ifort: warning #10146: no action performed for specified object file(s)
Marc in verbose: http://pastebin.com/6rd8v5Eh
Update 2 I am able to compile a dll file with these commands:
ifort /nologo /iface:stdcall /libs:dll /threads /c KDTree_mod.f90
link /NOLOGO /SUBSYSTEM:WINDOWS /manifest /dll /out:KDTree_mod.dll KDTree_mod.obj
mt /nologo “/outputresource:KDTree_mod.dll;#2″ /manifest KDTree_mod.dll.manifest
.modfile, you also have to link in the appropriate library (it will be an.obj.or a.dll). You must search the manual of your software providing the module about how to do that. - Vladimir Fifort /c KDTree_mod.f90created also something else than the.modfiles, perhaps an.obj,.oor.outor a similar file. - Vladimir F.objfiles in. Which exact command do you lunch? How do you compile and link your subroutine with the program? - Vladimir F