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:
Does any friend has experience on this? Or I appreciate your warm help on this
Thanks a lot!
== Detailed Information ==
Windows XP SP1, Windows 2000 Server (version 5.2.3790)
Visual Studio 2003 Version 7.1.3088
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.