在 Windows 7 中的 geany 下执行 fortran 代码不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3657520/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:12:10  来源:igfitidea点击:

Executing fortran code doesn't work under geany in windows 7

windowsfortrangeany

提问by Eddy

I'm having trouble getting a simple piece of fortran90 code to work. Here is the code for helloworld.f90:

我无法让一段简单的 fortran90 代码工作。这是 helloworld.f90 的代码:

PROGRAM hello
 IMPLICIT NONE

 PRINT *,"Hello world!"

END PROGRAM hello

When I compile and build, there are no errors. But as soon as I click on execute, this error appears in the command prompt:

当我编译和构建时,没有错误。但是一旦我点击执行,这个错误就会出现在命令提示符中:

'"./helloworld"' is not recognized as an internal or external command, operable program or batch file.

How do I get it to work? I'm using geany as an IDE, and when using Ubuntu linux it works just fine. It's when I run it under windows 7 that I get this problem. These are the compile and build commands:

我如何让它工作?我使用 geany 作为 IDE,当使用 Ubuntu linux 时它工作得很好。当我在 Windows 7 下运行它时,我遇到了这个问题。这些是编译和构建命令:

Compile: gfortran -Wall -c "helloworld.f90" (in directory: C:\Users\Eddy\Documents\Code\Fortran)
Build: gfortran -Wall -o "helloworld" "helloworld.f90" (in directory: C:\Users\Eddy\Documents\Code\Fortran)

采纳答案by Eddy

It turns out I didn't have the fortran compiler installed after all! I followed the instructions from hereto install it.

原来我根本没有安装fortran编译器!我按照此处的说明进行安装。

回答by Wildcat

Something is wrong with your Geany.

你的 Geany 有问题。

./helloworld

will not work under Windows. It's from *nix world.

在 Windows 下将无法工作。它来自 *nix 世界。

Instead of Geany you can use any text editor with Fortran support (for Windows take a look at jEdit, Programmer's Notepad). Or use Geany as editor but do compilation and execution from command-line.

您可以使用任何支持 Fortran 的文本编辑器代替 Geany(对于 Windows,请查看jEdit程序员的记事本)。或者使用 Geany 作为编辑器,但从命令行进行编译和执行。

If you want an IDE install Eclipseand then Photran.

如果您想要 IDE 安装Eclipse,然后安装Photran