Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

My project is using Multithread Debug MTd

anniehui
2007-11-12
2013-04-22
  • anniehui
    anniehui
    2007-11-12

    Hi,

    I having major problem. I had to test a project using MultiThread Debug RunTime Library and not MultiThread Debug DLL (MDd) as used in CPPUnit. Is there anything I can do to continue the testing ?

    Pls advice. Thanks in advance.
    Annie

     
    • hai you
      hai you
      2009-04-20

      I met the same issue. My project depends on some legacy libraries built with Multi-threaded (/MT), so I have to set my own project to the same option, same as my test project. But when I run the test project, I met a "Debug Assertion Failed!" error:

      File: dbgheap.c, Line: 1132
      Expression: _CrtIsValidHeapPointer(pUserData)

      Then I made a very simple project to do some experiments. This project has a class with a public function which just return 0. A test class is created to test that class.

      When I run this simple project, I get the same error.

      Here is some detail information:

      IDE: Visual Studio 2003 V7.1.3088
      MS .NET Framework: 1.1.4322

      Project Setting:
      - Add "CPPUNIT_DLL" in the C/C++ | Preprocessor Definitions.
      - In debug version, C/C++ | Code Generation | Runtime Library, set to Multi-threaded Debug (/MTd).
      - In Linker | Input | Additional Dependencies, set "cppunittd_dll.lib".
      - Built the cppunit_dll project and copy the cppunit_dl.dll to the debug folder of the simple project.

      Can anybody help to look at this issue? I can send out the sample project once required. Thanks a lot!

       
    • hai you
      hai you
      2009-04-20

      // Class to be tested:

      class MTTestee
      {
      public:
          MTTestee(void) {}
          ~MTTestee(void) {}
          int FunctionTestee() { return 0; }
      };

      // Test class

      #include <cppunit\testcase.h>
      #include <cppunit\extensions\helpermacros.h>

      class MTTestClass : public CppUnit::TestCase
      {
          CPPUNIT_TEST_SUITE(MTTestClass);
          CPPUNIT_TEST(TestFunctionTestee);
          CPPUNIT_TEST_SUITE_END();
      public:
          MTTestClass(void);
          ~MTTestClass(void);

          void TestFunctionTestee();
          {
              MTTestee testee;
              testee.FunctionTestee();
          }
      };

      // Main function

      #include <cppunit/ui/text/TestRunner.h>
      #include <cppunit/extensions/TestFactoryRegistry.h>

      #include "MTTestClass.h"

      CPPUNIT_TEST_SUITE_REGISTRATION(MTTestClass);

      int _tmain(int argc, _TCHAR* argv[])
      {
          CppUnit::TextUi::TestRunner runner;
          CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
          runner.addTest(registry.makeTest());
          runner.run();

          return 0;
      }