Dec 022008
 

I’m not a huge C++ developer nor a VS wizard, so I thought I would write down how I got GoogleTest setup in a C++ project I’m using VS 2008 for.

  1. Download it
  2. Add it as an existing project to your solution by right clicking on the “Solution ‘your-project'” part of the Solution Explorer
  3. Compile it (if you want)
  4. Right click your project and open the Properties
  5. Click on ‘Common Properties -> Frameworks and References’
  6. Add a Reference to the GoogleTest project
  7. Click on ‘Configuration Properties-> C++’
  8. Under the ‘Additional Include Directories’ add the a new directory that points to the include directory inside the GoogleTest distribution
  9. Click on ‘Configuration Properties -> C++ -> Code Generation’ and change all of the projects to ‘Multi-threaded Debug (/MTd)’

Another thing I realized is that it is probably best to create a separate project for the tests within your solution. I created a Win32 Console Application project in my solution and followed the above steps for that project. I also then needed to add a reference to the project I am testing within my test-project. (Slightly annoying, cumbersome and verbose).

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">