codeblock 编译googletest
1、cmake安装
2、codeblock 16.01
4、PATH路径添加(重启电脑,保证设置的PATH路径生效)
5、python安装
6、编译安装: http://www.cnblogs.com/TenosDoIt/p/3412721.html
错误:
||=== Build: Debug in d (compiler: GNU GCC Compiler) ===|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h||In function 'int testing::internal::posix::StrCaseCmp(const char*, const char*)':|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h|1719|error: '_stricmp' was not declared in this scope|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h||In function 'char* testing::internal::posix::StrDup(const char*)':|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h|1721|error: '_strdup' was not declared in this scope|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h||In function 'int testing::internal::posix::FileNo(FILE*)':|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h|1729|error: '_fileno' was not declared in this scope|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h||In function 'FILE* testing::internal::posix::FDOpen(int, const char*)':|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h|1779|error: 'fdopen' was not declared in this scope|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
解决: 在codeblocks上的build-options上去除-std=C++11 ,添加-std=gnu++
错误:
||=== Build: all in gtest (compiler: GNU GCC Compiler) ===|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h||In function 'void testing::internal::SleepMilliseconds(int)':|
D:\source\googletest-release-1.7.0\include\gtest\internal\gtest-port.h|1193|error: 'nanosleep' was not declared in this scope|
D:\source\googletest-release-1.7.0\src\gtest-death-test.cc|123|warning: 'testing::internal::g_in_fast_death_test_child' defined but not used [-Wunused-variable]|
CMakeFiles\gtest.dir\build.make|62|recipe for target 'CMakeFiles/gtest.dir/src/gtest-all.cc.obj' failed|
CMakeFiles\Makefile2|66|recipe for target 'CMakeFiles/gtest.dir/all' failed|
D:\source\googletest-release-1.7.0\codeblocks-mingw\Makefile|82|recipe for target 'all' failed|
||=== Build failed: 4 error(s), 1 warning(s) (0 minute(s), 1 second(s)) ===|
解决:注释 nanosleep 这一行
编译Google Test 1.8.0,出现很多编译错误,有可能是Mingw版本过老