Advertisement Jump to content
Sign in to follow this  
pumpkinwolf

cppunit can't pass compile

This topic is 3713 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!