Author Topic: Trying to compile old Fortran  (Read 10742 times)

Offline djcmalvern

  • Single posting newcomer
  • *
  • Posts: 3
Trying to compile old Fortran
« on: October 08, 2014, 09:27:58 pm »
I have inherited some Fortran77 files and I am trying to re-compile into 64-bit environment (windows 8.1).  Running code::blocks with gnu fortran compiler get following build log output:

mingw32-g++.exe   -c C:\forfiles\FortranFiles\Circle.for -o C:\forfiles\FortranFiles\Circle.o
mingw32-g++.exe  -o C:\forfiles\FortranFiles\Circle.exe C:\forfiles\FortranFiles\Circle.o   
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x3b): undefined reference to `_gfortran_st_write'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x59): undefined reference to `_gfortran_transfer_character_write'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x67): undefined reference to `_gfortran_st_write_done'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x9d): undefined reference to `_gfortran_st_read'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0xba): undefined reference to `_gfortran_transfer_real'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0xc8): undefined reference to `_gfortran_st_read_done'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x114): undefined reference to `_gfortran_st_write'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x132): undefined reference to `_gfortran_transfer_character_write'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x14f): undefined reference to `_gfortran_transfer_real_write'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x15d): undefined reference to `_gfortran_st_write_done'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x17f): undefined reference to `_gfortran_set_args'
C:\forfiles\FortranFiles\Circle.o:Circle.for:(.text+0x193): undefined reference to `_gfortran_set_options'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
12 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Can you point me to the best tutorial resource and/or tell me where to start configuring code::blocks and the compiler module for Fortran please?

djcmalvern

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Trying to compile old Fortran
« Reply #1 on: October 08, 2014, 09:45:54 pm »
Have you tried this http://bit.ly/1v32C1r ?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline djcmalvern

  • Single posting newcomer
  • *
  • Posts: 3
Re: Trying to compile old Fortran
« Reply #3 on: October 09, 2014, 12:21:58 pm »
Yes oBFusCATed that was very clever.

But it did not help me to find out how to configure C::B to use different command line entry when calling the Fortran compiler, ie my question.

Offline djcmalvern

  • Single posting newcomer
  • *
  • Posts: 3
Re: Trying to compile old Fortran
« Reply #4 on: October 09, 2014, 12:25:05 pm »
Thanks stahta01 this looks exactly like what I need. I will work through it and hopefully solve my issue.

 

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Trying to compile old Fortran
« Reply #5 on: October 09, 2014, 07:50:36 pm »
Thanks stahta01 this looks exactly like what I need. I will work through it and hopefully solve my issue.

 

I am not a mingw user, but to me it looks like you are trying to compile and link fortran code using g++, i.e. the C++ compiler/linker. I think you need to set up the C::B toolchain so that fortran files are compiled and linked with gfortran, not g++. This is important for proper runtime libraries and possibly other issues.