Menu

How to access CPPUNIT in MSVC++ 6.0 project?

Help
Anonymous
2002-01-22
2002-04-20
  • Anonymous

    Anonymous - 2002-01-22

    Hi.  I'm quite new to CPPUNIT.  I'm giving it a test run for my team. 

    I'd like to set up the non-gui version of CPPUNIT, so it can be accessed by many programmers using many projects--without having to duplicate the .h and .obj files.  To do this, I generated the necessary libs on our network server.  To test it out, I then created a VC++ project in a seperate directory and added the include and lib CPPUNIT paths to my VC++ project settings.

    However, I find that when I try to compile a class I've derived from TestCase, the compiler can't find several files that TestCase.h includes.  For instance, here's one compiler error I'm getting: "Cannot open include file: 'cppunit/Portability.h': No such file or directory."

    So my question is--what paths do I need to set up in my project settings to be able to compile a VC++ program that resides in a directory seperate from the CPPUNIT files?

    Thanks so much!

     
    • Tom Plunket

      Tom Plunket - 2002-01-22

      Include path in project settings (C/C++ tab) would be blah/cppunit/include/, then "#include <cppunit/something.h>" would find something.h in cppunit/include/cppunit/, which is how the distribution that I grabbed is set up.

      If you insert the CppUnit project into your workspace as a dependency of each project that needs it, it appears that the output (cppunit.lib or cppunitd.lib) gets linked in automatically.  Otherwise, just set the "library include path" in project settings (Link tab) to the directory where CppUnit's libs are getting built to; I don't know what it is off hand but probably something like blah/cppunit/lib/.  Obviously everyone needs to have the same view of the network for any of this to work; the most convenient way is to enforce that everyone maps the same shared drive letter to the shared area on your server.

       
    • Lynn Allan

      Lynn Allan - 2002-04-20

      CppUnit assistance

      I came across a webpage by John Lam that may be useful.  I believe it is specifically concerned with an earlier version of cppunit, but I found it useful to get cppunit to compile/link with visual c++.

      http://www.iunknown.com/Articles/fog0000000025.html

      I put together something similar that may be useful for ver 1.8.0.  There is a very simple, barebones vc6 full project that updates the "cookbook" example for vc6 that used a Complex class.  It has the settings all predone and can serve as a template.  It is assumed to be 'installed' at:
      <cppunit_home>\exmaples\msvc6\ComplexVc6Cookbook.

      The vc6 project (including .dsw, .dsp, .cpp, and .exe) is available directly from:
      http://prdownloads.sourceforge.net/inverse/ComplexVc6Cookbook.zip
      or:
      http://home.att.net/~bibleinverse/Misc/ComplexVc6Cookbook.zip

      There is also a somewhat fuller example using a simple Employee class. The included .dsw and .dsp already have the settings for resolving includes, libs, and dll's. It is assumed to be 'installed' at:
      <cppunit_home>\exmaples\msvc6\EmpVc6Cookbook.

      The vc6 project (.dsw, .dsp, .cpp, and .exe) is available directly from:
      http://prdownloads.sourceforge.net/inverse/EmpVc6Cookbook.zip
      or:
      http://home.att.net/~bibleinverse/Misc/EmpVc6Cookbook.zip

      There is yet another example with a less simple Employee class.  It was actually written to document a possible flaw in cppunit, but can also serve as a vc6 example.  Realize there is some flaky/confusing code in it that illustrate which 'handler' is called by the cppunit framework.

      This Employee class has std::strings for _firstname and _lastname.  Equality is considered having the first and last names being the same, without case sensitivity.  Therefore, a 'deep' compare is required for CPPUNIT_ASSERT_EQUAL rather than a shallow compare of whether the pointers are the same.

      This vc6 project (including .dsw, .dsp, .cpp, and .exe) has the settings for includes, multi-thread dll's, and .lib. It assumes that it is installed at:
      <cppunit_home>\examples\msvc6\Emp_Vc6

      It is available directly at:
      http://prdownloads.sourceforge.net/inverse/CppUnit_EmpVc6_5.zip
      or:
      http://home.att.net/~bibleinverse/Misc/CppUnit_EmpVc6_5.zip

      HTH,
      Lynn Allan

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.