===========windows运行gtest=================
STEP1: 下载cygwin安装,默认在c:\cygwin
STEP2: 下载gtest1.6,解压并拷贝到cygwin的目录下,即c:\cygwin的某个子目录下
STEP3: hack src/gtest.cc:808行的gettimeofday(window没有这个函数,参考http://blog.chinaunix.net/uid-140978-id-3029195.html)
替换 :gettimeofday(&now, NULL);
替换成:
FILETIME ft;
long long *time64 = (long long *) &ft;
GetSystemTimeAsFileTime (&ft);
*time64 -= 116444736000000000LL;
*time64 /= 10;
now.tv_sec = *time64 / 1000000;
now.tv_usec = *time64 % 1000000;
STEP4: 进入make子目录,去掉Makefile中的最后一行的 -lpthread(window无pthread库)
STEP5: 执行make,生成并运行sample1_unittest.exe,截图略