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版本过老

  • 相关阅读:
    VS2008开发的MFC程序,静态连接的方法
    [delphi]参数带有默认值的函数
    __cplusplus的用处
    去掉输入法上的CH和EN
    Linux下Socket的简单使用及最简化封装
    VS2008 _CRT_SECURE_NO_WARNINGS 的问题
    VC:对话框中菜单的使用(WM_INITMENUPOPUP)
    VC:CFindReplaceDialog(非模态对话框、IsWindow()、m_fr、GetFindString())
    献给初学编程者
    VC:状态栏(AfxGetMainWnd()、GetDescendantWindow()、SetPaneInfo()、SetPaneText())
  • 原文地址:https://www.cnblogs.com/hzijone/p/5926014.html
Copyright © 2011-2022 走看看