Fortran: Difference between revisions

Jump to navigation Jump to search
707 bytes added ,  13 July 2020
Line 115: Line 115:
=== Compiling the code ===
=== Compiling the code ===


  mkoctfile -I. octave_file_io.cc  
Generate {{Path|octave_file_io.o}} from {{Path|octave_file_io.cc}}.
  mkoctfile -I. --mkoctfile --link-stand-alone octave_file_io_example.f90 octave_file_io.o -o octave_file_io_example
 
mkoctfile -I. -c octave_file_io.cc
 
Generate {{Path|octave_file_io_example.exe}} from {{Path|octave_file_io_example.f90}} including {{Path|octave_file_io.o}}.
 
mkoctfile -I. --link-stand-alone octave_file_io_example.f90 octave_file_io.o -o octave_file_io_example.exe -lgfortran
 
If you receive errors about missing libraries, make sure your <code>LD_LIBRARY_PATH</code> is set correctly to find all Octave libraries, e.g.
 
$ ldd ./octave_file_io_example.exe
...
        libgfortran.so.4 => /usr/lib64/libgfortran.so.4 (0x00007fe9eb62b000)
        liboctinterp.so.8 => not found
        liboctave.so.8 => not found
...
 
Then find {{Path|liboctinterp.so.8}} and {{Path|liboctave.so.8}} on your system and type
 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/lib/octave/{{Release}}/
 


[[Category:Examples]]
[[Category:Examples]]

Navigation menu