Skip to main content
gamedev.net
🔒 Locked

cppunit can't pass compile

Started by pumpkinwolf Nov 19, 2008 at 4:44 AM 0 replies 1.2k views
Original Post
pumpkinwolf
pumpkinwolf
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 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 //------------------------------------------------------------------------------ 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?
rogma
rogma
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 ?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.