How to link external libraries (e.g. ANSYS bin library) with gcc

Nils Wagner nwagner@mecha.uni-stuttgart.de
Tue Nov 29 14:48:00 GMT 2005


Hi all,

I am going to build mor4ansys on a serial linux box (see below for details).
The source is available via

http://www.imtek.uni-freiburg.de/simulation/mor4ansys/src/mor4ansys-1.8.tar.gz

A make yields
gcc -c -g -O3  -I/var/tmp/taucs2.2/src/ -I/var/tmp/taucs2.2/build/linux/
-I/var/tmp/UMFPACKv4.4/UMFPACK/Include -I/var/tmp/mor4ansys-1.8/src
-I/opt2/ansys_inc/v81/ansys/customize/include mor4ansys.cpp
gcc -c -g -O3  -I/var/tmp/taucs2.2/src/ -I/var/tmp/taucs2.2/build/linux/
-I/var/tmp/UMFPACKv4.4/UMFPACK/Include -I/var/tmp/mor4ansys-1.8/src
-I/opt2/ansys_inc/v81/ansys/customize/include morbase.cpp
gcc -c -g -O3  -I/var/tmp/taucs2.2/src/ -I/var/tmp/taucs2.2/build/linux/
-I/var/tmp/UMFPACKv4.4/UMFPACK/Include -I/var/tmp/mor4ansys-1.8/src
-I/opt2/ansys_inc/v81/ansys/customize/include matrices.cpp
gcc -c -g -O3  -I/var/tmp/taucs2.2/src/ -I/var/tmp/taucs2.2/build/linux/
-I/var/tmp/UMFPACKv4.4/UMFPACK/Include -I/var/tmp/mor4ansys-1.8/src
-I/opt2/ansys_inc/v81/ansys/customize/include ansys.cpp
gcc -c -g -O3  -I/var/tmp/taucs2.2/src/ -I/var/tmp/taucs2.2/build/linux/
-I/var/tmp/UMFPACKv4.4/UMFPACK/Include -I/var/tmp/mor4ansys-1.8/src
-I/opt2/ansys_inc/v81/ansys/customize/include system.cpp
gcc -c -g -O3  -I/var/tmp/taucs2.2/src/ -I/var/tmp/taucs2.2/build/linux/
-I/var/tmp/UMFPACKv4.4/UMFPACK/Include -I/var/tmp/mor4ansys-1.8/src
-I/opt2/ansys_inc/v81/ansys/customize/include solvers.cpp
gcc -c -g -O3  -I/var/tmp/taucs2.2/src/ -I/var/tmp/taucs2.2/build/linux/
-I/var/tmp/UMFPACKv4.4/UMFPACK/Include -I/var/tmp/mor4ansys-1.8/src
-I/opt2/ansys_inc/v81/ansys/customize/include mor.cpp
ar crs libmor4ansys.a morbase.o matrices.o ansys.o system.o solvers.o mor.o
g++  -s mor4ansys.o libmor4ansys.a -L/home/nwagner/mor4ansys/bin -lbin
-L/home/nwagner/mor4ansys/ansys -lCEPCF90 -lPEPCF90 -lintrins -lF90
-lcxa -lcprts  -L/var/tmp/taucs2.2/lib/linux -ltaucs
-L/var/tmp/UMFPACKv4.4/UMFPACK/Lib -lumfpack
-L/var/tmp/UMFPACKv4.4/AMD/Lib -lamd -L/var/tmp/metis-4.0 -lmetis
-L/usr/local/lib/atlas -llapack -lf77blas -lcblas -latlas -lg2c  -o
mor4ansys
libmor4ansys.a(matrices.o)(.text+0xca1): In function
`SparseMatrix::removeZeros()':
/usr/include/g++/bits/stl_alloc.h:430: undefined reference to
`std::__default_alloc_template<(bool)1, (int)0>::_S_force_new'
libmor4ansys.a(matrices.o)(.text+0xd61):/usr/include/g++/bits/stl_alloc.h:430:
undefined reference to `std::__default_alloc_template<(bool)1,
(int)0>::_S_force_new'
libmor4ansys.a(matrices.o)(.text+0x2c50): In function
`SparseMatrix::read(std::basic_istream<char, std::char_traits<char> >&,
bool)':
/usr/include/g++/bits/stl_alloc.h:430: undefined reference to
`std::__default_alloc_template<(bool)1, (int)0>::_S_force_new'
libmor4ansys.a(matrices.o)(.text+0x2cc3):/usr/include/g++/bits/stl_alloc.h:430:
undefined reference to `std::__default_alloc_template<(bool)1,
(int)0>::_S_force_new'
libmor4ansys.a(matrices.o)(.text+0x309e):/usr/include/g++/bits/stl_alloc.h:430:
undefined reference to `std::__default_alloc_template<(bool)1,
(int)0>::_S_force_new'
libmor4ansys.a(matrices.o)(.text+0x31a0):/usr/include/g++/bits/stl_alloc.h:430:
more undefined references to `std::__default_alloc_template<(bool)1,
(int)0>::_S_force_new' follow
collect2: ld returned 1 exit status
make: *** [mor4ansys] Error 1


Any pointer how to fix this problem would be appreciated.

Thanks in advance
                       Nils


System information

Linux lisa 2.6.5-7.201-default #1 Thu Aug 25 06:20:45 UTC 2005 i686
athlon i386 GNU/Linux

Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada
--disable-checking --libdir=/usr/lib --enable-libgcj
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.3 (SuSE Linux)



More information about the Gcc-help mailing list