Linking to modules folder gives undefined reference

后端 未结 2 1727
春和景丽
春和景丽 2021-01-22 18:57

if I understood the manual correctly it should work to creat a file containing a fortran module in a folder, say /path/mods/test_mod.f90 i.e. :

module test_mod
i         


        
2条回答
  •  难免孤独
    2021-01-22 19:00

    You need to include the .o file as well. That is, you should compile this as

    gfortran -I/path/to/mods -o test_prog test_prog.f90 mods/test_mod.o
    

    This worked and ran for me.

提交回复
热议问题