I'm trying to use cppunit on a Mandrake 10.0 system. ./configure, make, make check, make install works fine. However when trying to compile a simple test program, I get linker errors.
The errors:
$ g++ main.cpp -lcppunit
/usr/local/lib/libcppunit.so: undefined reference to `dlclose'
/usr/local/lib/libcppunit.so: undefined reference to `dlopen'
/usr/local/lib/libcppunit.so: undefined reference to `dlsym'
collect2: ld returned 1 exit status
I using CppUnit on Debian testing and had the same problems as the original poster. After adding the -ldl flag, I was able to compile my sample test case easily enough. However, when I run the resulting executable, I get
"./test_gnarl: error while loading shared libraries: libcppunit-1.10.so.2: cannot open shared object file: No such file or directory"
What can I do to fix this problem?
Thanks in advance for any help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm trying to use cppunit on a Mandrake 10.0 system. ./configure, make, make check, make install works fine. However when trying to compile a simple test program, I get linker errors.
The errors:
$ g++ main.cpp -lcppunit
/usr/local/lib/libcppunit.so: undefined reference to `dlclose'
/usr/local/lib/libcppunit.so: undefined reference to `dlopen'
/usr/local/lib/libcppunit.so: undefined reference to `dlsym'
collect2: ld returned 1 exit status
main.cpp:
#include <cppunit/TextTestRunner.h>
int main(int argc, char* argv[])
{
CppUnit::TextTestRunner runner;
runner.run();
return 0;
}
This is the whole program.
Can anyone help with this? I didn't find anything similar on the forums.
Thanks in advance
Sebastian
You must link with the 'dl dynamic library' library.
I think it's -ldl (check cppunit command during compilation for confirmation).
Baptiste.
I using CppUnit on Debian testing and had the same problems as the original poster. After adding the -ldl flag, I was able to compile my sample test case easily enough. However, when I run the resulting executable, I get
"./test_gnarl: error while loading shared libraries: libcppunit-1.10.so.2: cannot open shared object file: No such file or directory"
What can I do to fix this problem?
Thanks in advance for any help.