gtest在VS2010中测试工程的搭建

gtest版本 1.7.0

Windows 8.1

VS 2010

gtest在VS2010中测试工程的搭建_第1张图片

1)运行msvc文件夹中的gtest.sln。正常会有一个升级的过程。编译成功后会生成gtest.lib库文件,留作后面项目使用。

2)新建win32控制台项目gtest_demo

3)向项目中添加或者新建samples/sample1.cc,samples/samples.h, samples/sample1_unittest.cc, src/gtest_main.cc

4)配置项目,共有三个配置非常重要

l  配置gtest包含目录

gtest在VS2010中测试工程的搭建_第2张图片

l  添加gtest.lib

gtest在VS2010中测试工程的搭建_第3张图片

l  运行库配置

gtest在VS2010中测试工程的搭建_第4张图片

最终生成的gtest_demo.exe可以在cmd中运行,如下图。

gtest在VS2010中测试工程的搭建_第5张图片

你可能感兴趣的:(visual,studio,2010,gtest)