Does by any chance your gfortran
version differ from the version of your g++
? Or maybe it is installed in a different location?
The -lname
option (in this case name
is gfortran
) instructs the linker to search for a library file called libname.a
in the library search path. If found and no static linking is enforced by the -[B]static
option the linker will search once again for libname.so
and link against it instead (if found). If libname.a
is not found an error will be given despite the presence of libname.so
.
There should be a libgfortran.a
somewhere in your gfortran
installation. Search for it with find
and provide the path to g++
with -L/path/to/compiler/libs
. If g++
is the same version as your gfortran
the path to libgfortran.a
will already be present in the library search path (since both C/C++ and Fortran static libraries reside in the same place). It will not be present if both compilers differ in their version though.
For example on a 64-bit RedHat based system libgfortran.a
is located in /usr/lib/gcc/x86_64-redhat-linux/<GCC version>/
while the shared libgfortran.so.*
are located in /usr/lib64
.
An alternative solution is to replace -lgfortran
with /usr/lib/libgfortran.so.3
.
The -L.
option is rather related to -lCGAL
than to -lgfortran
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…