My project is using Multithread Debug MTd

  • anniehui

    anniehui - 2007-11-12


    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.

    • 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
          MTTestee(void) {}
          ~MTTestee(void) {}
          int FunctionTestee() { return 0; }

      // Test class

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

      class MTTestClass : public CppUnit::TestCase

          void TestFunctionTestee();
              MTTestee testee;

      // Main function

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

      #include "MTTestClass.h"


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

          return 0;


Log in to post a comment.