Menu

Auto-Registration failing in libs in VC++ 6.0

Anonymous
2002-01-03
2002-01-14
  • Anonymous

    Anonymous - 2002-01-03

    I have been having trouble with the CPPUNIT_TEST_SUITE_REGISTRATION macro in a library.  VC++ does not seem to recognize the fact that the test class is being stored in a static variable elsewhere.  The net result of this is that the file does not get linked in, so the CPPUNIT_TEST_SUITE_REGISTRATION macro never get's executed and the test never gets added.

    Has anyone else had this problem, or does anyone else know of a way to fix this aside from forcing a link by acessing a member of the CPP file from the executable?

     
    • Mark Delaney

      Mark Delaney - 2002-01-04

      Look at my 2 posts in the thread on "possible bugs in Registry extension files?".

      I got the CPPUNIT_TEST_SUITE_REGISTRATION macro working by putting the CPPUNIT_TEST_SUITE_REGISTRATION macro for every test suite in the same file as a function that gets linked. This kept the MSVC linker happy. When I put each CPPUNIT_TEST_SUITE_REGISTRATION macro in the various cpp files where each test suite was defined, as any sane programmer would, my test suites were not added.

      Hope this helps!

      Mark Delaney

       
    • Tom Plunket

      Tom Plunket - 2002-01-14

      hmm-

      My first foray into CppUnit was this past week- I had objects split into three files, say "object.h", "object.cpp", and "object_t.cpp".  I put TEST_SUITE_REGISTRATION and all of the test code AND the CppUnit::TestCase-derived class definition in the _t.cpp file.  Compiled and linked fine.  I could take all of the _t.cpp files out of the project and everything still worked as it should have.  I thought that was beauty.

       

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.