Jump to content
  • Advertisement
Sign in to follow this  

cppunit in VC++2008 Express (SOLVED)

This topic is 3679 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

Hi. Just downloaded cppunit to try out in my projects, but I can't compile it in VC++ 2008 Express. I looked on google and the cppunit website but I could not find any info on this. Has anyone here compiled it on this? if so, could you give instructions or a link to the precompiled libs? thanks. [Edited by - dean nolan on April 23, 2008 8:34:06 AM]

Share this post


Link to post
Share on other sites
Advertisement
I can't remember off hand as I was at work. :(
I will try again when I get home and will look into the 2005 MFC building in the docs and see if that helps.

I will let you know later how it goes, if well I will upload the compiled headers if anyone wants to use them, unless that's against the licence of using cppunit? I will have to check.

Thanks.

Share this post


Link to post
Share on other sites
So I managed to compile the lib in VS2005 at work, the website says that express editions can't build it.

I then try a sample project using VSC++ 2008 Express (my compiler as it's free)

I get the following errors:
[Source]
Linking...
cppunitd.lib(TestFactoryRegistry.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base::~_Container_base(void)" (__imp_??1_Container_base@std@@QAE@XZ) referenced in function "public: __thiscall std::_Tset_traits<class CppUnit::TestFactory *,struct std::less<class CppUnit::TestFactory *>,class std::allocator<class CppUnit::TestFactory *>,0>::~_Tset_traits<class CppUnit::TestFactory *,struct std::less<class CppUnit::TestFactory *>,class std::allocator<class CppUnit::TestFactory *>,0>(void)" (??1?$_Tset_traits@PAVTestFactory@CppUnit@@U?$less@PAVTestFactory@CppUnit@@@std@@V?$allocator@PAVTestFactory@CppUnit@@@4@$0A@@std@@QAE@XZ)
cppunitd.lib(TestSuite.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base::~_Container_base(void)" (__imp_??1_Container_base@std@@QAE@XZ)
cppunitd.lib(TestPath.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base::~_Container_base(void)" (__imp_??1_Container_base@std@@QAE@XZ)
cppunitd.lib(TestFactoryRegistry.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base::_Container_base(void)" (__imp_??0_Container_base@std@@QAE@XZ) referenced in function "public: __thiscall std::_Tset_traits<class CppUnit::TestFactory *,struct std::less<class CppUnit::TestFactory *>,class std::allocator<class CppUnit::TestFactory *>,0>::_Tset_traits<class CppUnit::TestFactory *,struct std::less<class CppUnit::TestFactory *>,class std::allocator<class CppUnit::TestFactory *>,0>(struct std::less<class CppUnit::TestFactory *>)" (??0?$_Tset_traits@PAVTestFactory@CppUnit@@U?$less@PAVTestFactory@CppUnit@@@std@@V?$allocator@PAVTestFactory@CppUnit@@@4@$0A@@std@@QAE@U?$less@PAVTestFactory@CppUnit@@@1@@Z)
cppunitd.lib(TestSuite.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base::_Container_base(void)" (__imp_??0_Container_base@std@@QAE@XZ)
cppunitd.lib(TestPath.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base::_Container_base(void)" (__imp_??0_Container_base@std@@QAE@XZ)
cppunitd.lib(TestSuite.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base::_Orphan_all(void)const " (__imp_?_Orphan_all@_Container_base@std@@QBEXXZ) referenced in function "protected: void __thiscall std::vector<class CppUnit::Test *,class std::allocator<class CppUnit::Test *> >::_Tidy(void)" (?_Tidy@?$vector@PAVTest@CppUnit@@V?$allocator@PAVTest@CppUnit@@@std@@@std@@IAEXXZ)
cppunitd.lib(TestPath.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base::_Orphan_all(void)const " (__imp_?_Orphan_all@_Container_base@std@@QBEXXZ)
C:\Documents and Settings\deann\My Documents\Visual Studio 2008\Projects\core\Debug\core.exe : fatal error LNK1120: 3 unresolved externals
Build log was saved at "file://c:\Documents and Settings\deann\My Documents\Visual Studio 2008\Projects\core\core\Debug\BuildLog.htm"
core - 9 error(s), 0 warning(s)
[/Source]


my source code is;
[Source]

#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>

#pragma comment(lib,"cppunitd.lib")


int main(int argc, char* argv[])
{
// Get the top level suite from the registry
CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();



return 0;
}
[/Source]


the lib is in the correct folder i set up with the VS tools->options and the project settings are setup correctly.

Anyone know what i'm doin wrong?

Share this post


Link to post
Share on other sites
Well I tried using it in a VS2005 project and it worked. So I played about with compiling for 2008 Express.

The problem is that cppunit uses MFC in its test runner and MFC is not included with express editions :(
So it looks like i'm going to have to use a different unit testing framework.

Oh well.

Share this post


Link to post
Share on other sites
Quote:
Original post by dean nolan
Well I tried using it in a VS2005 project and it worked. So I played about with compiling for 2008 Express.

The problem is that cppunit uses MFC in its test runner and MFC is not included with express editions :(
So it looks like i'm going to have to use a different unit testing framework.

Oh well.

You might want to try CppUnitLite - it's written by the same guy who wrote CppUnit in the first place, then got cheesed off that it was becoming too heavyweight and bloated.

Share this post


Link to post
Share on other sites
Another option is UnitTest++. It doesn't have runners or anything fancy, but it's very lightweight and it works perfectly with the express editions of vc++.

Share this post


Link to post
Share on other sites
I like cxxtest. It does require perl to build the test cases, but this can be trivially added to build process.

It's header only, lightweight, and pretty straight-forward.

Share this post


Link to post
Share on other sites
I have looked at the other 3 posted. I liked the idea of CppUnitLite but it doesn't support some features I would like, fixtures and the test runner seemed a good idea. Maybe if I was to find a modified version that would be good.

Unit++ seemed like a lot of work to create tests when i looked over it, maybe I'll look again.

And cxxtest seemed like it would be the best one. However, and this was only with a quick glance, getting it integrated with Visual Studio I have to have 3 extra projects in my solution?

Maybe I am missing something though ;)

Thanks for the suggestions.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!