开发者社区> 问答> 正文

cygwin中编译gtest出错.水平不够看不出来问题,望大神指导. 400 请求报错 

在cygwin下编译gtest.
已经 export $GTEST_HOME=$HOME/test/common/gtest
编译中出现这样的错误. 在linux环境编译正常. 请大神指导一下.谢谢

~/test/common/gtest/make
$make
g++ -I.. -I../include -g -Wall -Wextra -c ../samples/sample1_unittest.cc
In file included from ../include/gtest/gtest-param-test.h:159:0,
                 from ../include/gtest/gtest.h:59,
                 from ../samples/sample1_unittest.cc:48:
../include/gtest/internal/gtest-param-util-generated.h: In instantiation of ‘testing::internal::ValueArray2<T1, T2>::operator testing::internal::ParamGenerator<T>() const [with T = bool; T1 = bool; T2 = bool]’:
../include/gtest/gtest-param-test.h:1186:28:   required from here
../include/gtest/internal/gtest-param-util-generated.h:80:26: 错误:‘ValuesIn’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
     return ValuesIn(array);
                          ^
In file included from ../include/gtest/gtest.h:59:0,
                 from ../samples/sample1_unittest.cc:48:
../include/gtest/gtest-param-test.h:288:58: 附注:‘template<class Container> testing::internal::ParamGenerator<typename Container::value_type> testing::ValuesIn(const Container&)’ declared here, later in the translation unit
 internal::ParamGenerator<typename Container::value_type> ValuesIn(
                                                          ^
Makefile:75: recipe for target 'sample1_unittest.o' failed
make: *** [sample1_unittest.o] Error 1

展开
收起
kun坤 2020-06-01 10:01:16 1018 0
1 条回答
写回答
取消 提交回答
  • 最终还是自己解决了.只是解决问题,但问题所在还不是很清楚.
    1. 该gtest是从protobuf中提取的,版本为1.4.0. 去go0glecode下载最新版本 1.7.0
    2. 确定g++为cygwin g++, 且环境变量是干净的.
     2.1 在计算机->属性->高级->环境变量中 看下有没有安装其他的C编译软件.如MinGW
      或者在$PATH变量里看看有没有.
    检查变量为: 
    C_INCLUDE_PATH
    CPP_INCLUDE_PATH
    LIBRARY_PATH
    PATH
    清除掉冗余项或者多义项
    3. 安装最近g++ . 因为这个原因,我把整个镜像都ftp下来,差点没把磁盘弄爆.

    2020-06-01 10:01:22
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
15分钟打造你自己的小程序更新版 立即下载
前端自动化测试 立即下载
《15分钟打造你自己的小程序》 立即下载