• Advertisement
Sign in to follow this  

cppunit can't pass compile

This topic is 3383 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using codeblocks for writing some unit test code.But when I finished code, I can't pass compile.I set the project in codeblocks as "GUI applicaiton". The header file: #ifndef _clsTestSuit_assert_h #define _clsTestSuit_assert_h #include <cppunit/extensions/HelperMacros.h> class clsTestSuit_Assert : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( clsTestSuit_Assert ); CPPUNIT_TEST( testAdd ); CPPUNIT_TEST_SUITE_END(); public: void setUp(); void tearDown(); void testAdd(); private: }; #endif The cpp file: include "clsTestSuit_assert.h" #include <cppunit/extensions/HelperMacros.h> //------------------------------------------------------------------------------ void clsTestSuit_Assert::setUp() // Comment: // [in]: // [out]: // [return]: // [5/6/2008 by duomaxwell] //------------------------------------------------------------------------------ { } //------------------------------------------------------------------------------ void clsTestSuit_Assert::tearDown() // Comment: // [in]: // [out]: // [return]: // [5/6/2008 by duomaxwell] //------------------------------------------------------------------------------ { } void clsTestSuit_Assert::testAdd() { CPPUNIT_ASSERT_MESSAGE("TEST", false); } The result it come many error LNK2019 and error LNK2001 But if I implement the "testAdd" in .h file, just like: class clsTestSuit_Assert : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( clsTestSuit_Assert ); CPPUNIT_TEST( testAdd ); CPPUNIT_TEST_SUITE_END(); public: void setUp(); void tearDown(); void testAdd() {CPPUNIT_ASSERT_MESSAGE("TEST", false);} private: }; it just warning what can I do with it?

Share this post


Link to post
Share on other sites
Advertisement
I do not know if it will help but where is your suite registration ?

the should have something like :

CPPUNIT_TEST_SUITE_REGISTRATION(clsTestSuit_Assert) ;

and also do you have a main ?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement