Menu

cppunit won't compile with RH 9.0 / gcc 3.2.2

Help
Anonymous
2003-04-29
2003-06-06
  • Anonymous

    Anonymous - 2003-04-29

    Can someone please help me with below:

    cppunit libs compile fine, but TestSuite won't compile in
    test framework.  These compiled fine with RH 7.2 & 7.3 / gcc 2.96

    ----------------------------------------------------
    cppunit 1.8.0 errors type 1
    ----------------------------------------------------

    make

    g++ -g -LANG:std -D_STANDARD_C_PLUS_PLUS -I/usr/local/include -I/usr/local/include/cppunit -I/home/herarg/projects/parser  -c main.cpp
    In file included from main.cpp:2:
    AsiStringOperatorsTest.hxx: In static member function `static CppUnit::Test*
       AsiStringOperatorsTest::suite()':
    AsiStringOperatorsTest.hxx:24: invalid use of undefined type `struct
       CppUnit::TestSuite'
    /usr/local/include/cppunit/ui/text/TestRunner.h:12: forward declaration of `
       struct CppUnit::TestSuite'
    AsiStringOperatorsTest.hxx:25: parse error before `;' token
    AsiStringOperatorsTest.hxx:28: parse error before `;' token
    AsiStringOperatorsTest.hxx:31: cannot convert `CppUnit::TestSuite*' to `
       CppUnit::Test*' in return
    make: *** [main.o] Error 1

    Compilation exited abnormally with code 2 at Tue Apr 29 10:39:34

    ----------------------------------------------------
    sample source for error type 1
    ----------------------------------------------------

    #ifndef AsiStringOperatorsTest_H
    #define AsiStringOperatorsTest_H
    #include "AsiString.hxx"
    #include <TestFixture.h>

    class AsiStringOperatorsTest : public CppUnit::TestFixture
    {
    public:
      static CppUnit::Test *suite()
      {
        CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "AsiStringOperatorsTest" );
        suiteOfTests->addTest( new CppUnit::TestCaller<AsiStringOperatorsTest>(
                                          "testEqualsOperator",
                                          &AsiStringOperatorsTest::testEquality ) );
        suiteOfTests->addTest( new CppUnit::TestCaller<AsiStringOperatorsTest>(
                                          "testPlusOperator",
                                          &AsiStringOperatorsTest::testAddition ) );
        return suiteOfTests;
      }

    protected:
      virtual void setUp();

      virtual void tearDown();

      void testEqualsOperator();

      void testPlusOperator();

    private:
      asi::String _testString;
      char *_testValue1;
      char *_testValue2;
    };

    #endif  // AsiStringOperatorsTest_H

    ----------------------------------------------------
    cppunit 1.8.0 errors 2
    ----------------------------------------------------

    main.o(.gnu.linkonce.t._ZN7CppUnit10TestCallerI25TestOM_AttributeFlyweightNS_19NoExceptionExpectedEED0Ev+0x4f):/usr/include/c++/3.2.2/bits/basic_string.tcc:620: undefined reference to `CppUnit::TestCase::~TestCase [not-in-charge]()'
    main.o(.gnu.linkonce.t._ZN7CppUnit10TestCallerI16TestOM_FlyweightNS_19NoExceptionExpectedEED1Ev+0x4f):/usr/include/c++/3.2.2/bits/basic_string.tcc:620: undefined reference to `CppUnit::TestCase::~TestCase [not-in-charge]()'
    main.o(.gnu.linkonce.t._ZN7CppUnit10TestCallerI16TestOM_FlyweightNS_19NoExceptionExpectedEED0Ev+0x4f):/usr/include/c++/3.2.2/bits/basic_string.tcc:620: more undefined references to `CppUnit::TestCase::~TestCase [not-in-charge]()' follow

    ----------------------------------------------------
    cppunit 1.9.10 errors (make errors when attempting
                           to build cppunit source)
    ----------------------------------------------------

    mmake[2]: Entering directory `/usr/local/src/cppunit-1.9.10/src/cppunit'
    source='DynamicLibraryManager.cpp' object='DynamicLibraryManager.lo' libtool=yes \ depfile='.deps/DynamicLibraryManager.Plo' tmpdepfile='.deps/DynamicLibraryManager.TPlo' \ depmode=gcc3 /bin/sh ../../config/depcomp \ /bin/sh ../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include    -g -O2 -c -o DynamicLibraryManager.lo `test -f DynamicLibraryManager.cpp || echo './'`DynamicLibraryManager.cpp
    rm -f .libs/DynamicLibraryManager.lo
    g++ -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include -g -O2 -c DynamicLibraryManager.cpp -MT DynamicLibraryManager.lo -MD -MP -MF .deps/DynamicLibraryManager.TPlo  -fPIC -DPIC
    In file included from DynamicLibraryManager.cpp:4:
    ../../include/cppunit/plugin/DynamicLibraryManagerException.h:20: looser throw
       specifier for `virtual
       CppUnit::DynamicLibraryManagerException::~DynamicLibraryManagerException()'
    /usr/include/c++/3.2.2/stdexcept:118:   overriding `virtual
       std::runtime_error::~runtime_error() throw ()'
    ../../include/cppunit/plugin/DynamicLibraryManagerException.h:20: looser throw
       specifier for `virtual
       CppUnit::DynamicLibraryManagerException::~DynamicLibraryManagerException()'
    /usr/include/c++/3.2.2/stdexcept:118:   overriding `virtual
       std::runtime_error::~runtime_error() throw ()'
    ../../include/cppunit/plugin/DynamicLibraryManagerException.h:20: looser throw
       specifier for `virtual
       CppUnit::DynamicLibraryManagerException::~DynamicLibraryManagerException()'
    /usr/include/c++/3.2.2/stdexcept:118:   overriding `virtual
       std::runtime_error::~runtime_error() throw ()'
    make[2]: *** [DynamicLibraryManager.lo] Error 1
    make[2]: Leaving directory `/usr/local/src/cppunit-1.9.10/src/cppunit'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/usr/local/src/cppunit-1.9.10/src'
    make: *** [all-recursive] Error 1

    Compilation exited abnormally with code 2 at Tue Apr 29 10:46:47

     
    • Anonymous

      Anonymous - 2003-06-06

      Apparently, The fix/workaround submitted in the BUGS area by Jan Docekal fixed my problem (I've copied text below, for reference.)

      [ 638701 ] make fails RH8.0,cppunit-1.9.10 fix inc.
            (?) 
      Submitted By:
      Jan Docekal (docekal) Date Submitted:
      2002-11-14 17:12
      Last Updated By:
      Item Submitter - Tracker Item Submitted Date Last Updated:
      No updates since submission. 
      Category:
      Unix-Compilation Group:
      None
      Assigned To:
      Nobody/Anonymous (nobody) Priority:
      5
      Status:
      Open Resolution:
      None
      Summary:
      make fails RH8.0,cppunit-1.9.10 fix inc.
      Hi,

      When I build cppunit-1.9.10 on RedHat Linux 8.0 I get a
      compile error when compiling the DLLPluginTester (I
      suspect that this error will occur on all UNIX systems,
      but have no means of testing this). I strongly suspect
      that this is due to the fact that this code is only
      intended to run on Windows and the problem is that:

      1) The configure script does not recognize this and
      does not set the correct defines.

      2) Setting the correct defines is not enought since the
      plugin tests are not protected by #ifdefs (so you get
      an error when compiling the test).

      Since I'm not very uset to configure scripts (I changed
      to Linux recently) I'm not able to present a correction
      of the script. Instead I present a workaround that can
      be used until someone more knowledgable can provide a
      rela solution.

      $ ./configure
      $ mv src/DllPlugInTester/Makefile
      src/DllPlugInTester/Makefile.useplugin
      $ cat > src/DllPlugInTester/Makefile

      all:
      echo "No DllPlugins possible on UNIX
      (RedHatLinux 8.0)"

      check:
      echo "No DllPlugins possible on UNIX
      (RedHatLinux 8.0)"

      install:
      echo "No DllPlugins possible on UNIX
      (RedHatLinux 8.0)"

      [ctrl-D]
      // What should 'DEFS' be defiend to in make commands
      below on your system?!
      // Check what DEFS is defined to (grep DEFS configure)
      and append
      // -DCPPUNIT_NO_TESTPLUGIN to that value below)
      // (In my case grep found DEFS=-DHAVE_CONFIG_H)
      $ make DEFS='-DHAVE_CONFIG_H -DCPPUNIT_NO_TESTPLUGIN'
      $ make DEFS='-DHAVE_CONFIG_H -DCPPUNIT_NO_TESTPLUGIN' check
      $ su
      # make DEFS='-DHAVE_CONFIG_H -DCPPUNIT_NO_TESTPLUGIN'
      install
      # exit
      $

       

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.