This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ld problem


Hi folks,

I have written an application, compiled and created a library(I called it libmustik.so) , using gnu g++-2.95.3.
Later on I wrote some test cases, using CppUnit, using my newly created library.
I encounted the problem that ld failed during linkage, throwing me some undefine references on some methods in my lib.

g++ -O0 -Wall -fpic -pthread -I../../inc -o MustikTest MustikTest.cpp -L../../lib -lmustiktest -lmustik -lpthread -lrt -lcppunit
../../lib/libmustik.so: undefined reference to `fs::Collection<fs::FileSystem>::~Collection(void)'
../../lib/libmustik.so: undefined reference to `fs::_Iterator<fs::FileSystem>::~_Iterator(void)'
../../lib/libmustik.so: undefined reference to `fs::_Iterator<fs::FileSystem>::_Iterator(void)'
../../lib/libmustik.so: undefined reference to `fs::Collection<fs::FileSystem>::Collection(void)'
../../lib/libmustik.so: undefined reference to `fs::Collection<fs::FileSystem>::getPatternSet(void)'
collect2: ld returned 1 exit status

That brought me to think I had a problem in my code. I looked for it whithout success ( as far as my c++ knowledge allows it ), all mentioned methods have been properly implemented, I think.
Running the same compilation with the 3.2 version throwed me even more error messages than whith the 2.95.3 version, there were a lot of CppUnit methods that could not be referenced, what brought me to think the problem may not lay on my code but on a wrong usage of g++...

...
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/../../../libcppunit.so: undefined reference to `streambuf::pbackfail(int)'
../../lib/libmustik.so: undefined reference to `fs::_Iterator<fs::FileSystem>::_Iterator[not-in-charge]()'
../../lib/libmustiktest.so: undefined reference to `CppUnit::TestCase::runTest()'
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/../../../libcppunit.so: undefined reference to `streambuf::sys_seek(long long, ios::seek_dir)'
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/../../../libcppunit.so: undefined reference to `ostream type_info node'
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/../../../libcppunit.so: undefined reference to `streambuf::xsputn(char const *, int)'
...

I would appreciate some help solving this problem.

Thanks

---
Eric Tchepannou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]