News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Trying to compile old Fortran

Started by djcmalvern, October 08, 2014, 09:27:58 PM

Previous topic - Next topic

djcmalvern

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

oBFusCATed

(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!]

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

djcmalvern

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.

djcmalvern

Thanks stahta01 this looks exactly like what I need. I will work through it and hopefully solve my issue.


cacb

Quote from: djcmalvern 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.



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.