I'm trying to install a large atmospheric model (WRF) on my newly set up Centos 7 machine.
To start the installation process, the model's developers give a series of environmental tests. My set up fails the fourth one--Fortran Calling a C Function. (I passed the first three: fixed and free format Fortran and C only.)
This test consists of two small programs.
First, TEST_4_fortran+c_c.c:
::::::::::::::
TEST_4_fortran+c_c.c
::::::::::::::
#ifndef CRAY
# ifdef NOUNDERSCORE
# define C_TEST c_test
# else
# ifdef F2CSTYLE
# define C_TEST c_test__
# else
# define C_TEST c_test_
# endif
# endif
#endif
#include
int C_TEST ( float *xx, int *ii )
{
printf(" C function called by Fortran\n" ) ;
printf(" Values are xx = %5.2f and ii = %d \n", *xx, *ii ) ;
return(0) ;
}
Compiling it "gcc -c -m64 TEST_4_fortran+c_c.c" went fine with no errors.
The second program, TEST_4_fortran+c_f.f90:
PROGRAM foo
INTEGER :: ii
REAL :: xx
ii = 1
xx = 2
CALL c_test ( xx , ii )
print *,'SUCCESS test 4 fortran calling c'
END PROGRAM foo
Compiling gfortran -c -m64 TEST_4_fortran+c_f.f90
also had no errors.
When I attempt to execute the fortran gfortran -m64 TEST_4_fortran+c_f.o
I get:
TEST_4_fortran+c_f.o: In function `MAIN__':
TEST_4_fortran+c_f.f90:(.text+0x2f): undefined reference to `c_test_'
collect2: error: ld returned 1 exit status
I just installed Centos 7, so everything is "out of the box."
Asked by MrCatDad
(11 rep)
Dec 3, 2019, 04:54 PM
Last activity: Dec 3, 2019, 05:07 PM
Last activity: Dec 3, 2019, 05:07 PM