簡體   English   中英

錯誤提升::文件系統沒有名為string()的成員

[英]error boost::filesystem has no member named string()

我正在嘗試在機器上(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

對我來說,似乎在節點上安裝了一個較舊版本的boost。 較早版本的boost :: filesystem :: path沒有string成員函數。 檢查包含路徑,編譯器從某處獲取錯誤的頭。 您可以在gcc命令行中添加一些其他參數,以查看實際使用了哪些包含文件。 請參閱: / show在g ++中包含等效選項

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM