编译Mapnik遇std命名空间错误,求助编译器适配问题
编译Mapnik源码时的std::filesystem相关错误排查
我在本地Linux Mint 21.2机器上从Mapnik源码编译,编译过程中出现错误终止,起始错误如下:
include/mapnik/filesystem.hpp:38:21: error: expected namespace name namespace fs = std::filesystem; ~~~~~^ include/mapnik/filesystem.hpp:39:25: error: no type named 'error_code' in namespace 'std' using error_code = std::error_code; ~~~~~^ src/fs.cpp:40:12: error: use of undeclared identifier 'fs' return fs::exists(filepath); ^
后续还有更多衍生错误,且编译前出现大量关于unary函数已弃用的警告:
In file included from mason_packages/.link/include/boost/type_index/stl_type_index.hpp:47: mason_packages/.link/include/boost/container_hash/hash.hpp:131:33: warning: 'unary_function<std::type_index, unsigned long>' is deprecated [-Wdeprecated-declarations] struct hash_base : std::unary_function<T, std::size_t> {}; ^
我按照Mapnik的Linux安装指南操作,指南明确要求支持C++14标准的编译器,因此怀疑是编译器问题。我已成功添加ubuntu-toolchain-r/test PPA,但安装gcc-6时提示无该包。当前我的编译器版本为:
gcc -v:gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)g++ -v:与gcc为同义词clang -v:Ubuntu clang version 14.0.0-1ubuntu1.1
请问上述错误是否因编译器不兼容导致?
内容的提问来源于stack exchange,提问作者uke
相关产品推荐
相关产品推荐

