GFortran and CodeBlocks issue with Modules and Multiple Files

后端 未结 3 1765
暖寄归人
暖寄归人 2020-12-20 05:06

I am working with GFortran and CodeBlocks but I\'m having an issue about Modules and Multiple files. i keep getting this error:

Fatal Error: Can\'t open modu         


        
3条回答
  •  情歌与酒
    2020-12-20 05:32

    The problem is that in CodeBlocks "projects are built in the order of appearence, from top to bottom" (CodeBlocks Wiki), in other words, the files are compiled alphabetically. Which means that in my case, Derivatives.f90 was being compiled before than Main.f90 causing the error.

    A way to circumvent the problem is to set only the Main.f90 file as build target in CodeBlocks:

    • Menu Project/Properties...
    • In Build Target Files at the tab Build targets check only Main.f90

    And use the command Include 'File_Name.f90' inside the Main.f90 code to include the other f90 files for compilation in the right order.

提交回复
热议问题