Hello All, & thanks in advance for your advice.
I have a FORTRAN program that needs to link to a static library compiled from C/C++ code.
portland group compiler
CC = pgcc
C++FLAGS= -fPIC
.C.o: $(SRC)
$(CC) $(C++FLAGS) -c $<
lib: $(OBJ)
ar r libNAME.a $(OBJ)
The Makefile compiles the code & creates the *.a w/o complaint
The link step, for lack of actually knowing how to do it, looks like this…
f90 = pgf90
getlLIB = -L/path -lNAME
pName : $(OBJ)
$(f90) -o pName $(OBJ) $(getlLIB)
\
I am using 'extern “C” ’ around the C function referenced by FORTRAN, & do not appear too have name-mangling issues. However the compile step (new Makefile) seems to complain about a lack of C/C++ libraries. Error messages from the compile include (but are not limited to):
path/NAME.a(getl.o): In function getl_': path/./getl.C:73: undefined reference to
std::cout(void)’
path/./getl.C:80: undefined reference to operator new(unsigned long)' path/./getl.C:82: undefined reference to
std::cout(void)’
path/./getl.C:97: undefined reference to std::cout(void)' path/NAME.a(getl.o): In function
__sti___6_getl_C_b0e82dec’:
path/./getl.C:103: undefined reference to std::ios_base::_Loc_init::__ct( (void))' path/./getl.C:103: undefined reference to
__record_needed_destruction’
path/./getl.C:103: undefined reference to std::ios_base::Init::__ct( (void))' path/./getl.C:103: undefined reference to
__record_needed_destruction’
path/NAME.a(getl.o):(.data+0x0): undefined reference to `__T_Q2_3std8ios_base’
etc.
\
I am thinking the problem is in the compile step, but I have been unable to find documentation for this particular case. All help is appreciated!
Andy