Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29236 Discussions

A program can be compiled successfully, but not under gfortran??

changks888
Beginner
868 Views
Hi -
I am working on model comparison across various platform and computering environment.
A program can be compiled successfully using ifort, however I got some errors when I use gofrtran to compile it. (It can be compiled using gfortran in the Linux, but I am trying to compile it on a Mac.)
Below shows the errors:
gfortran main.o climate.o weather.o vegetation.o biogeochem.o initial.o humidity.o \\
radiation.o readpars.o canopy.o physiology.o snow.o soil.o utilities.o \\
ctemfire.o disturbance.o diagnostics.o io-cfs.o ies-io.o math.o stats.o nag-soil.o \\
-ffixed-line-length-132 -I/usr/local/include -L/usr/local/lib -lnetcdff -o ibis
Undefined symbols for architecture x86_64:
"_time_", referenced from:
_MAIN__ in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [ibis] Error 1
bash-3.2$
I really appreciate your solutions and suggestions. Please help me.
Michael
0 Kudos
1 Solution
Steven_L_Intel1
Employee
868 Views
The error you show is from linking, not compiling. It looks as if you are referencing a function named TIME which is not provided. TIME is provided as a generic intrinsic subroutine by Intel Fortran, but it is an extension, perhaps one that gfortran does not support. If portability is a goal, use the DATE_AND_TIME standard intrinsic instead. Read about it in the documentation.

View solution in original post

0 Kudos
3 Replies
Steven_L_Intel1
Employee
869 Views
The error you show is from linking, not compiling. It looks as if you are referencing a function named TIME which is not provided. TIME is provided as a generic intrinsic subroutine by Intel Fortran, but it is an extension, perhaps one that gfortran does not support. If portability is a goal, use the DATE_AND_TIME standard intrinsic instead. Read about it in the documentation.
0 Kudos
changks888
Beginner
868 Views
Good hint! The original time function was dtime in gfortran. Thanks Steve!!!
0 Kudos
TimP
Honored Contributor III
868 Views
dtime() and etime() were legacy precursors to the f95 intrinsic cpu_time, which could be used to replace them.
0 Kudos
Reply