Menu

Linker errors on Mandrake 10.0

Help
2004-07-09
2004-07-12
  • Sebastian Beschke

    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

     
    • Baptiste Lepilleur

      You must link with the 'dl dynamic library' library.

      I think it's -ldl (check cppunit command during compilation for confirmation).

      Baptiste.

       
      • Layne

        Layne - 2004-07-12

        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.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.