emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: orgbabel with fortran code


From: pietru
Subject: Re: orgbabel with fortran code
Date: Wed, 5 May 2021 23:02:30 +0200

Have had a first go with your code

I wrote the following, then went inside the code and slammed "C-c C-c" 

#+BEGIN_SRC fortran :tangle fortran-comline.f90
program cli
  implicit none ! no implicit declaration: all variables must be declared
  character(1000) :: arg
  
  call get_command_argument(1, arg) ! result is stored in arg, see 
  ! https://gcc.gnu.org/onlinedocs/gfortran/GET_005fCOMMAND_005fARGUMENT.html
  
  if (len_trim(arg) == 0) then ! no argument given
      write (*,*) "Call me --world!"
  else
      if (trim(arg) == "--world") then
          call get_command_argument(2, arg)
          if (len_trim(arg) == 0) then
              arg = "again!"
          end if
          write (*,*) "Hello ", trim(arg)
          ! trim reduces the fixed-size array to non-blank letters
      end if
  end if
end program
#+END_SRC

And then I wrote this, went inside the code and slammed "C-c C-c" 

#+BEGIN_SRC sh :results output :exports both
  gfortran -std=gnu -O3 fortran-comline.f90 -o fortran-comline
  ./fortran-comline
  ./fortran-comline --world World
  ./fortran-comline --world
#+END_SRC

But I am getting some major whining

/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function 
`_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
sh: 2: ./fortran-comline: not found
sh: 3: ./fortran-comline: not found
sh: 4: ./fortran-comline: not found



> Sent: Thursday, May 06, 2021 at 7:50 AM
> From: "Dr. Arne Babenhauserheide" <arne_bab@web.de>
> To: pietru@caramail.com
> Cc: emacs-orgmode@gnu.org
> Subject: Re: orgbabel with fortran code
>
> pietru@caramail.com writes:
> 
> > Have you got exomples with fortran code yourself?  I would like to 
> > scrutinise them. 
> 
> I have this, but I no longer know whether it actually executes fortran
> inline or only tangles it:
> 
> https://www.draketo.de/files/2017-04-10-Mo-fortran-commandline-tool.org
> https://www.draketo.de/files/surprises.org
> 
> From
> https://www.draketo.de/english/free-software/fortran
> https://www.draketo.de/light/english/fortran-surprises
> 
> Best wishes,
> Arne
> -- 
> Unpolitisch sein
> heißt politisch sein
> ohne es zu merken
> Message-ID: <87h7jh2qh7.fsf@web.de>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]