在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
最终还是自己解决了.只是解决问题,但问题所在还不是很清楚.
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下来,差点没把磁盘弄爆.
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。