zoukankan      html  css  js  c++  java
  • codeblock 编译googletest

    1、cmake安装

    2、codeblock  16.01 

    3、Google Test 1.7.0

    4、PATH路径添加(重启电脑,保证设置的PATH路径生效)

    5、python安装

    6、编译安装:  http://www.cnblogs.com/TenosDoIt/p/3412721.html

    错误:

    ||=== Build: Debug in d (compiler: GNU GCC Compiler) ===|
    D:sourcegoogletest-release-1.7.0includegtestinternalgtest-port.h||In function 'int testing::internal::posix::StrCaseCmp(const char*, const char*)':|
    D:sourcegoogletest-release-1.7.0includegtestinternalgtest-port.h|1719|error: '_stricmp' was not declared in this scope|
    D:sourcegoogletest-release-1.7.0includegtestinternalgtest-port.h||In function 'char* testing::internal::posix::StrDup(const char*)':|
    D:sourcegoogletest-release-1.7.0includegtestinternalgtest-port.h|1721|error: '_strdup' was not declared in this scope|
    D:sourcegoogletest-release-1.7.0includegtestinternalgtest-port.h||In function 'int testing::internal::posix::FileNo(FILE*)':|
    D:sourcegoogletest-release-1.7.0includegtestinternalgtest-port.h|1729|error: '_fileno' was not declared in this scope|
    D:sourcegoogletest-release-1.7.0includegtestinternalgtest-port.h||In function 'FILE* testing::internal::posix::FDOpen(int, const char*)':|
    D:sourcegoogletest-release-1.7.0includegtestinternalgtest-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:sourcegoogletest-release-1.7.0includegtestinternalgtest-port.h||In function 'void testing::internal::SleepMilliseconds(int)':|
    D:sourcegoogletest-release-1.7.0includegtestinternalgtest-port.h|1193|error: 'nanosleep' was not declared in this scope|
    D:sourcegoogletest-release-1.7.0srcgtest-death-test.cc|123|warning: 'testing::internal::g_in_fast_death_test_child' defined but not used [-Wunused-variable]|
    CMakeFilesgtest.diruild.make|62|recipe for target 'CMakeFiles/gtest.dir/src/gtest-all.cc.obj' failed|
    CMakeFilesMakefile2|66|recipe for target 'CMakeFiles/gtest.dir/all' failed|
    D:sourcegoogletest-release-1.7.0codeblocks-mingwMakefile|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版本过老

  • 相关阅读:
    [leetcode]49. Group Anagrams变位词归类
    [leetcode]40. Combination Sum II组合之和(每元素限用一次)
    [leetcode]39. Combination Sum组合之和
    [leetcode]35. Search Insert Position寻找插入位置
    [leetcode]28. Implement strStr()实现strStr()
    [leetcode]25. Reverse Nodes in k-Group每k个节点反转一下
    [leetcode]24. Swap Nodes in Pairs交换节点对
    SVG基础知识 Adobe Illustrator绘制SVG
    Java静态方法和实例方法 java中的数组作为形参传入
    SVG可伸缩的矢量图形
  • 原文地址:https://www.cnblogs.com/hzijone/p/5926014.html
Copyright © 2011-2022 走看看