Results 1 to 6 of 6

Thread: How to execute gfortran helloworld program

  1. #1
    Join Date
    Feb 2010
    Location
    nh,usa
    Posts
    167

    Default How to execute gfortran helloworld program

    Sorry if this is the wrong forum, such a basic question.

    I've written the canonical fortran program that writes "hello world".

    I've installed gfortran, compiled my hello.f, and get a.out.

    How do you execute a.out?

    Thank you.

  2. #2
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: How to execute gfortran helloworld program

    Let me assume you are in the directory where a.out is, then type
    Code:
    ../a.out

    --
    PC: oS 11.4 x86_64 | Intel Core i7-2600@3.40GHz | 16GB | KDE 4.6.0 |
    GeForce GT 420
    Eee PC 1201n: oS 12.1 x86_64 | Intel Atom 330@1.60GHz | 3GB | KDE 4.8.1
    | nVidia ION
    eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10 |
    xf86-video-geode

  3. #3
    Join Date
    Jul 2011
    Location
    Alpharetta, Georgia, USA
    Posts
    289

    Default Re: How to execute gfortran helloworld program

    Er, um, uh, arg.... Martin's instructions are correct, however he has one too many dots. From the directory where a.out resides, try:

    ./a.out
    Laptop #1: OpenSUSE Leap 15.0 (x86_64) | HP ZBook 17 G2 (17")
    Laptop #2: OpenSUSE Leap 15.0 (x86_64) | System76 Darter (14")

  4. #4
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: How to execute gfortran helloworld program

    Am 12.03.2012 02:06, schrieb gldickens3:
    >
    > Er, um, uh, arg.... Martin's instructions are correct, however he has
    > one too many dots. From the directory where a.out resides, try:
    >
    >> ./a.out

    >
    >

    Thank you, no idea where the second dot came from.


    --
    PC: oS 11.4 x86_64 | Intel Core i7-2600@3.40GHz | 16GB | KDE 4.6.0 |
    GeForce GT 420
    Eee PC 1201n: oS 12.1 x86_64 | Intel Atom 330@1.60GHz | 3GB | KDE 4.8.1
    | nVidia ION
    eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10 |
    xf86-video-geode

  5. #5
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: How to execute gfortran helloworld program

    On 2012-03-12 02:07, Martin Helm wrote:
    > Thank you, no idea where the second dot came from.


    On the nntp side there is only one dot :-?

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,966

    Default Re: How to execute gfortran helloworld program

    @rih53342. And you should of course check if it has the execute bit set for that file.
    And you could of course put it in the bin directory that is normaly in your home directory, which is in your PATH environment variable and thus allows you to just call
    Code:
    a.out
    And I advise you to give your program a proper name with the option the compiler has for it, because to have a buch of programs all having the intrigueing name a.out will give you problems some time in the future.
    Henk van Velden

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •