Running a fortran code from octave

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Running a fortran code from octave

Prithivirajan V
Hello All,

 want to run a fortran program within Octave. I would like to do this for automation purposes and use Octave for all the data processing.

Is it possible to run a fortran program from octave using cygwin, if so, could you provide me some pointers along that direction ?

Moreover, I have a gfortran compiler installed in my system, Is there a way I could make use of it to complete my task mentioned above ?

Furthermore, I tried to use mex to perform the same:

mckoctfile --mex HelloWorld.f

I got the following error after trying the mex approach:

c:/octave/octave~1.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\rajan\AppData\Local\Temp/oct-qur1RF. o: in function hi': C:\Tech Stuff\Fortran Programs/HelloWorld.f:3: undefined reference to _gfortran_st_write' c:/octave/octave~1.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Tech Stuff\Fortran Programs/HelloWorld.f:3 : undefined reference to _gfortran_transfer_character_write' c:/octave/octave~1.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Tech Stuff\Fortran Programs/HelloWorld.f:3 : undefined reference to _gfortran_st_write_done' c:/octave/octave~1.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\rajan\AppData\Local\Temp/oct-qur1RF. o: in function main': C:\Tech Stuff\Fortran Programs/HelloWorld.f:6: undefined reference to _gfortran_set_args' c:/octave/octave~1.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Tech Stuff\Fortran Programs/HelloWorld.f:6 : undefined reference to `_gfortran_set_options' collect2.exe: error: ld returned 1 exit status warning: mkoctfile: building exited with failure sta

How do I resolve this error to move forward?