美文网首页
mingw+clion编译googletest+模板

mingw+clion编译googletest+模板

作者: 里卡多伊泽克森多斯桑托斯TV | 来源:发表于2020-03-22 13:36 被阅读0次

1.编译环境
win10,安装mingw及clion,过程略
2.下载googletest源码,
https://github.com/google/googletest.git
3.默认CMakeList.txt编译报错,需要修改CMakeList.txt增加:

SET(CMAKE_CXX_FLAGS "-std=gnu++11 -Wno-deprecated-declarations")

4.编译gmock, gteset
5.生成库在cmake-build-debug\lib目录,头文件目录:cmake-build-debug\include, googletest\include.

参考:Leetcode 刷题系列模板

leetcode.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint-gcc.h>
#include <stdbool.h>

//#define MY_DEBUG(x, fmt...)     printf(x, ##fmt)
#define MY_DEBUG(x, fmt...)
#define MLOGD(x, fmt...)        MY_DEBUG("[%s_%d]"x, __func__, __LINE__, ##fmt)
//#define MLOGD(x, fmt...)
#define MLOGI(x, fmt...)        MY_DEBUG("[%s_%d]"x, __func__, __LINE__, ##fmt)
#define MLOGE(x, fmt...)        MY_DEBUG("[%s_%d]"x, __func__, __LINE__, ##fmt)

#define MIN(x, y)               ((x) < (y) ? (x) : (y))
#define MAX(x, y)               ((x) > (y) ? (x) : (y))
#define ARRAY_SIZE(x)           (sizeof(x) / sizeof(x[0]))

相关文章

网友评论

      本文标题:mingw+clion编译googletest+模板

      本文链接:https://www.haomeiwen.com/subject/dwomyhtx.html