解决make时出现的google的fatal error: google/protobuf/stubs/stringprintf.h:
主要原因是在include文件夹中找不到相应的文件,解决办法:
1、使用命令protoc --version
,查看目前安装的proto的版本,确定在3.0以上,如果不是,请更新:
sudo apt-get install libprotobuf-dev protobuf-compiler
2、更新完之后还是没有解决:在电脑中查找stringprintf.h文件,这里使用find -name stringprintf.h
查找,我这里查找到的路径是:
1、./.local/share/Trash/files/protobuf-all-3.17.3/protobuf-3.17.3/src/google/protobuf/stubs/stringprintf.h2、./install/protobuf-all-3.17.3/protobuf-3.17.3/src/google/protobuf/stubs/stringprintf.h
3、确定cmake中的include_directories(${PROTOBUF_INCLUDE_DIRS})
是什么路径,我在这里的路径是:/usr/local/include
这里cd到/google/protobuf/stubs下。ls查看是否缺失文件,(缺失)
使用 sudo cp stringprintf.* /usr/local/include/google/protobuf/stubs,将所有文件拷贝过来。
4、在/usr/local/include/google/protobuf/stubs下查看是否拷贝成功
ls
。