vs2012 中使用 gtest
2012-12-11 16:29
141 查看
1、下载:
http://code.google.com/p/googletest/downloads/list
2、编译:
用2012打开 gtest-1.6.0\msvc\gtest.sln, 编译gtest
此时会出错,有个解决的帖子:
http://code.google.com/p/googletest/issues/detail?id=412
其实就是一句话,
在 include\gtest\gtest.h 中添加#define _VARIADIC_MAX 10
ok后会生成 gtestd.lib (release版为gtest.lib)
3、使用:
在测试项目属性中添加include和lib
一段demo:
4、推荐文章:
http://www.cnblogs.com/coderzh/archive/2009/03/31/1426758.html
只为更简单! --Rydiy
http://code.google.com/p/googletest/downloads/list
2、编译:
用2012打开 gtest-1.6.0\msvc\gtest.sln, 编译gtest
此时会出错,有个解决的帖子:
http://code.google.com/p/googletest/issues/detail?id=412
其实就是一句话,
在 include\gtest\gtest.h 中添加#define _VARIADIC_MAX 10
#define GTEST_INCLUDE_GTEST_GTEST_H_ //add for vs2012 #define _VARIADIC_MAX 10 #include <limits> #include <vector>
ok后会生成 gtestd.lib (release版为gtest.lib)
3、使用:
在测试项目属性中添加include和lib
一段demo:
#include "stdafx.h" #include "gtest\gtest.h" int fun(int a, int b) { return (a-b); } TEST(fun, case1) { EXPECT_LT(0, fun(1, 2)); } int _tmain(int argc, _TCHAR* argv[]) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
4、推荐文章:
http://www.cnblogs.com/coderzh/archive/2009/03/31/1426758.html
只为更简单! --Rydiy
相关文章推荐
- 使用 VS 2012 编译 GTest 遇到的编译错误
- 使用 VS 2012 编译 GTest 遇到的编译错误
- 使用 VS 2012 编译 GTest 遇到的编译错误
- 在vs 2012 中使用xna 4.0 做开发!
- VS2012 使用MySql的API函数连接数据库(成功), 以及使用mysql-connector-c++-1.1.3遇到的问题!
- vs2012 scanf不能使用
- vs2012 使用STLport-5.2.1
- vs2012 使用STLport-5.2.1
- VS2012 编译使用boost库(附带VS2008)
- VS2012下boost 配置与使用
- 云中漫步 - 2:使用 VS2012 与 Windows Azure Web 站点创建并发布 ASP.NET Web 应用程序
- VS2012/2013(简称VS)Lua编辑和调试方面的工具------BabeLua的使用方法
- VS 2012: Post build 中使用 Signtool.exe,对于特殊password中字符的处理方法
- VS2012自带的 性能分析工具使用包括CPU和内存等自定义详解
- 在VS 2012中使用正则表达式
- 如何在Visual Studio(VS)2012里使用libsvm工具箱
- vs2012-vs2010使用stlport库的配置
- vs2012 编译jsoncpp和使用jsoncpp lib出现的问题
- vs2012下使用相对路径添加其他目录的方法
- VS技巧 使用Visual Studio Icon Patcher将2010的图片注入到2012中