[Unit Testing] CppUnit Doesn't Support /MT?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: [Unit Testing] CppUnit Doesn't Support /MT?

  1. #1
    Join Date
    Apr 2009
    Posts
    1

    [Unit Testing] CppUnit Doesn't Support /MT?

    Dear All,

    I want to use CppUnit as my unit test framework. Currently I'm trying to make my test project (and cppunit) work under compile option "Multi-threaded (/MT)". But when I prepare some test cases and run the test project, I get the following "Debug Assertion Failed!" error:

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

    Does any friend has experience on this? Or I appreciate your warm help on this
    Thanks a lot!

    == Detailed Information ==
    Environment:
    Windows XP SP1, Windows 2000 Server (version 5.2.3790)
    Visual Studio 2003 Version 7.1.3088
    CppUnit 1.12.1

    The CppUnit package has two projects, cppunit and cppunit_dll. For me the major difference is in project settings | C/C++ | Code Generation | Runtime Library. Cppunit is using Multi-threaded Dll (/MD), while cppunit_dll is using Multi-threaded (/MT).

    Enclosed is an very simple project I made to test if cppunit_dll works. It's a Win32 Console Project with the following setting (debug version):
    - Add CPPUNIT_DLL in the C/C++ | Preprocessor Definitions.
    - C/C++ | Code Generation | Runtime Library, set to Multi-threaded Debug (/MTd).
    - In Linker | Input | Additional Dependencies, set "cppunittd_dll.lib" as the dependency.
    - Build the cppunit_dll project and copy the cppunitd_dll.dll to the debug folder of the project.

    The code is very simple: I create a test class, with an empty test function. I use cppunit helper macros to add the test function and then register the test class. When I use the test runner to run the test case, I get the debug assertion fail.
    This error won't happen if I use "Multi-threaded Dll" compile option.

    Can any one help me? Thanks a lot!
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center