我正在尝试为我的机器(Ubuntu 12.04 LTS)和集群系统上的节点(CentOS)上使用boost的项目构建可执行文件。我设法在两台机器上安装源代码的boost。当我运行make
命令时,我能够在我的机器上获得项目的可执行文件,但节点上的 不是 。在群集节点上,它说:
source/MainCompressor.cpp: In member function ‘void MainCompressor::compress(std::__cxx11::string, std::__cxx11::string)’:
source/MainCompressor.cpp:76:80: error: ‘boost::filesystem::basic_path<std::__cxx11::basic_string<char>, boost::filesystem::path_traits>::string_type {aka class std::__cxx11::basic_string<char>}’ has no member named ‘string’
boost::filesystem::copy_file(reference, outpath + reference.filename().string());
^
source/MainCompressor.cpp:93:49: error: ‘boost::filesystem::basic_path<std::__cxx11::basic_string<char>, boost::filesystem::path_traits>::string_type {aka class std::__cxx11::basic_string<char>}’ has no member named ‘string’
compList << outpath << reference.filename().string() << endl;
^
source/MainCompressor.cpp:99:47: error: ‘boost::filesystem::basic_path<std::__cxx11::basic_string<char>, boost::filesystem::path_traits>::string_type {aka class std::__cxx11::basic_string<char>}’ has no member named ‘string’
string filename = filepath.filename().string();
^
source/MainCompressor.cpp: In member function ‘void MainCompressor::decompress(std::__cxx11::string, std::__cxx11::string)’:
source/MainCompressor.cpp:171:47: error: ‘boost::filesystem::basic_path<std::__cxx11::basic_string<char>, boost::filesystem::path_traits>::string_type {aka class std::__cxx11::basic_string<char>}’ has no member named ‘string’
string filename = filepath.filename().string();
我在两台机器上安装了相同版本的boost(1.55和1.59)。我不知道为什么我没有在我的机器上收到错误但在节点上收到错误。在这方面,任何帮助都将受到赞赏。
编辑1: 以下是我的路径变量设置:
PATH=/home/head/cmp/soft/sft/boost_1_59_0:/home/head/cmp/soft/sft/boost_1_55_0/bin:/home/head/cmp/soft/sft/gcc/bin:$PATH
答案 0 :(得分:0)
对我来说,在节点上看起来已经安装了较旧版本的boost。较早版本的boost :: filesystem :: path没有dlsym()
成员函数。
检查包含路径,编译器从某处获取错误的标头。
您可以向gcc命令行添加一些其他参数,以查看实际使用的包含文件。看到:
/show include equivalent option in g++