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.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]))
网友评论