Can't compile my simple fortran helloworld code

173 Views Asked by At

I'm completely new to fortran, and have only done some python and c++ before. I tried following a tutorial, but couldn't get my compiler to work.

When I try the program:

program helloworld
    print *,"Hello World!"
end program helloworld

saved as "fort.f" in notepad, using the g95 compiler for windows and then trying both

g95 -c fort.f

and

g95 fort.f -o fort

in the correct folder in cmd

I get this:

In file fort.f:1

program helloworld
 1
Error: Non-numeric character in statement label at (1)
In file fort.f:1

program helloworld
 1
Error: Unclassifiable statement at (1)
In file fort.f:3

end program helloworld
 1
Error: Non-numeric character in statement label at (1)
In file fort.f:3

end program helloworld
 1
Error: Unclassifiable statement at (1)
Error: Unexpected end of file in 'fort.f'

I have tried googling the errors, but don't see how they apply to this simple code, that is taken from a tutorial and thus should work. Probably something about my compiling command or installation of g95 then?

0

There are 0 best solutions below