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

aauutthh 发布于 2014/09/24 11:36
阅读 1K+
收藏 0

如何使用英特尔®oneAPI工具实现PyTorch 优化,直播火热报名中>>>


在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




加载中
0
a
aauutthh

最终还是自己解决了.只是解决问题,但问题所在还不是很清楚.

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下来,差点没把磁盘弄爆.

OSCHINA
登录后可查看更多优质内容
返回顶部
顶部