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.
- Download it
- Add it as an existing project to your solution by right clicking on the “Solution ‘your-project'” part of the Solution Explorer
- Compile it (if you want)
- Right click your project and open the Properties
- Click on ‘Common Properties -> Frameworks and References’
- Add a Reference to the GoogleTest project
- Click on ‘Configuration Properties-> C++’
- Under the ‘Additional Include Directories’ add the a new directory that points to the include directory inside the GoogleTest distribution
- 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).