mac安装protobuf2.4.1时报错./include/gtest/internal/gtest-port.h:428:10: fatal error: 'tr1/tuple' file not found和google/protobuf/message.cc:175:16: error: implicit instantiation of undefined template

时间:2023-03-09 03:50:22
mac安装protobuf2.4.1时报错./include/gtest/internal/gtest-port.h:428:10: fatal error: 'tr1/tuple' file not found和google/protobuf/message.cc:175:16: error: implicit instantiation of undefined template
通过网上下载的protobuf2.4.1的压缩文件,然后进行安装,./configure和make时遇到了两个问题。
正常的安装步骤如下:
./configure
make 
make check
make install
protoc —version
问题一
protobuf2.4.1通过下载的tar.gz文件安装时./configure报错:./include/gtest/internal/gtest-port.h:428:10: fatal error: 'tr1/tuple' file not found
mac安装protobuf2.4.1时报错./include/gtest/internal/gtest-port.h:428:10: fatal error: 'tr1/tuple' file not found和google/protobuf/message.cc:175:16: error: implicit instantiation of undefined template
解决方法
进入解压后的protobuf2.4.1目录,输入命令【./autogen.sh】生成configure文件
然后输入以下命令进行安装
./configure
make 
make check
make install
问题二
安装到make步骤时报错:google/protobuf/message.cc:175:16: error: implicit instantiation of undefined template
mac安装protobuf2.4.1时报错./include/gtest/internal/gtest-port.h:428:10: fatal error: 'tr1/tuple' file not found和google/protobuf/message.cc:175:16: error: implicit instantiation of undefined template
解决方法
编辑目录下的文件./src/google/protobuf/message.cc,添加头文件#include <istream>,问题解决,继续下面的安装步骤即可
mac安装protobuf2.4.1时报错./include/gtest/internal/gtest-port.h:428:10: fatal error: 'tr1/tuple' file not found和google/protobuf/message.cc:175:16: error: implicit instantiation of undefined template
备注
从git上下载protobuf2.4.1非常慢,然后再微盘上找到了一个下载资源http://vdisk.weibo.com/s/tYlk6JrNUYTY