如何在 Eclipse Phortran 中创建支持模块依赖关系的托管构建?
我已经安装了新的 Phortran 7 作为 PTP 的一部分。
我想使用 OOP 方法开发我的代码,这需要我有许多模块 我发现托管构建系统无法理解 .f90 文件中的依赖关系。
我现在正在研究这个问题一天。我将使用“假”项目解释我的问题
我的项目有 2 个文件
main.f90、module1.f90
main.f90 :
program main
use module1
implicit none
.....
code...
.....
end program main
module1.f90:
module module1
implicit none
contains
.....
code...
.....
end module module1
当我在 IDE 中使用托管 make 和 build 命令编译此代码时,我得到以下内容错误:
Fatal Error: Can't open module file 'module1.mod' for reading at (1): No such file or directory
make: *** [main.o] Error 1
makefile 似乎按照
从子目录文件中获取的字母顺序排列:
F90_SRCS += \
../main.f90 \
../module1.f90
OBJS += \
./main.o \
./module1.o
我确实检查了这一点,如果我在 main.f90 之前按照 modul1.f90 的顺序编译项目,一切都会很好。
但我的印象是IDE可以自动解决这个问题,Fortran中的USE关键字需要告诉IDE以什么顺序链接文件。
有人可以帮我解决这个问题吗?我在其他线程中读到托管 make 应该理解依赖关系。
非常感谢。
I have installed the new Phortran 7 as part of the PTP.
I want to develop my code using an OOP approach which requires me to have many modules
I have found that the managed build system doesn't understand dependencies in my .f90 files.
I was working on this problem for a day now. I will explain my problem using a "fake" project
My project have 2 files
main.f90, module1.f90
main.f90 :
program main
use module1
implicit none
.....
code...
.....
end program main
module1.f90:
module module1
implicit none
contains
.....
code...
.....
end module module1
When I compile this code using the managed make and build command in the IDE I get the following error:
Fatal Error: Can't open module file 'module1.mod' for reading at (1): No such file or directory
make: *** [main.o] Error 1
It seems like that makefile goes in the alphabet order
taken from the subdir file:
F90_SRCS += \
../main.f90 \
../module1.f90
OBJS += \
./main.o \
./module1.o
I did checked this and if the I compile the project in the order of modul1.f90 before main.f90 everything works great.
But I was under the impression that the IDE can automatically take care of this problem, the USE keyword in Fortran needs to tell the IDE what order to link the files.
Can someone help me with this, I have read in other threads that the managed make should understand dependencies.
Thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我做了一些解决方法,试图告诉 makefile 处理器找到依赖项。
(针对并行应用程序开发人员在 Eclipse 上进行了测试。版本:Juno Release。内部版本 ID:20120614-1722
。 2.在 Eclipse IDE 中,右键单击项目文件夹,然后 -> 重构 -> 子程序 -> 引入调用树。它应该向您显示模块中的所有依赖项。
您应该小心模块的顺序:
模块
使用它将运行的 (代码修改自 此处),
但如果您
对此
进行更改,您将得到相同的错误。
对于更大的程序,我使用了 手动 makefile 选项 。但为了调试,我使用了 Intel 调试器 idb,因为使用相同的 makefile Photran 的调试器没有设置断点。
祝你好运,朋友。
I've made a little workaround trying to tell the makefile processor to find the dependences.
(Tested on Eclipse for Parallel Application Developers. Version: Juno Release. Build id: 20120614-1722)
. 2.In the eclipse IDE make right click in your project folder then ->refactor->subprogram->introduce call tree. It should show you all the dependences in your modules.
You should be careful with the order of your modules:
with the module
it will run with (Code modified from here)
but if you change
for this
You'll get the same error.
For a bigger program i've used the manual makefile option. But for debugging i've used Intel debugger idb because with the same makefile Photran's debugger did't put the breakpoints.
Best luck pal.