0

==================================== The following command line for a "hello world"

program 

/usr/bin/gfortran -std=f95 -Wextra -Wall -O2 -c main.for 

==================================== produces the following errors.

cc -std=f95 -Wextra -Wall -O2  main.o -o main
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: main.o: in function `MAIN__':
main.for:(.text+0x2a): undefined reference to `_gfortran_st_write'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: main.for:(.text+0x3c): undefined reference to `_gfortran_transfer_character_write'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: main.for:(.text+0x44): undefined reference to `_gfortran_st_write_done'
/usr/lib64/gcc/x86_64-suse-linux/7/../../
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: main.for:(.text.startup+0x14): undefined reference to `_gfortran_set_options'
collect2: error: ld returned 1 exit status../../x86_64-suse-linux/bin/ld: main.o: in function `main':
main.for:(.text.startup+0x5): undefined reference to `_gfortran_set_args'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: main.for:(.text.startup+0x14): undefined reference to `_gfortran_set_options'
collect2: error: ld returned 1 exit status
make: *** [makefile:44: main] Error 1
rih5342
  • 81
  • 6

2 Answers2

0

This error occurs on both windows+cygwin and on linux.

In both cases there were two versions of gfortran installed, the default V7 and a user configured V8.

Checking the installs with >gfortran --version, worked worked in both cases (windows+cygwin and linux.), with no errors.

======================== My solution was to first eradicate all versions of gfortran and then second, reinstall the default version. I'm still figuring out how to install a user configured version.

rih5342
  • 81
  • 6
0

You may need to link gfortran library with -lgfortran