millanek / Dsuite

Fast calculation of Patterson's D (ABBA-BABA) and the f4-ratio statistics across many populations/species
162 stars 25 forks source link

the Dsuite_fBranch.h:63:84: error: no matching function for call to ‘regex_replace(std::string&, std::regex&, const char [1])’ string treeNoBranchLengths = std::regex_replace(treeString,branchLengths,""); #48

Open Jiangjiangzhang6 opened 2 years ago

Jiangjiangzhang6 commented 2 years ago

when I compile,its show the error, how can I slove this.

g++ -c -std=c++11 Dsuite.cpp -o Build/Dsuite.o In file included from Dsuite.cpp:13:0: Dsuite_fBranch.h: In constructor ‘Tree::Tree(std::string)’: Dsuite_fBranch.h:63:84: error: no matching function for call to ‘regex_replace(std::string&, std::regex&, const char [1])’ string treeNoBranchLengths = std::regex_replace(treeString,branchLengths,""); ^ Dsuite_fBranch.h:63:84: note: candidates are: In file included from /usr/include/c++/4.8.2/regex:62:0, from Dsuite_utils.h:20, from Dsuite.cpp:9: /usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type) regex_replace(_Out_iter out, _Bi_iter first, _Bi_iter last, ^ /usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template argument deduction/substitution failed: In file included from Dsuite.cpp:13:0: Dsuite_fBranch.h:63:84: note: deduced conflicting types for parameter ‘_Bi_iter’ (‘std::basic_regex’ and ‘const char*’) string treeNoBranchLengths = std::regex_replace(treeString,branchLengths,""); ^ In file included from /usr/include/c++/4.8.2/regex:62:0, from Dsuite_utils.h:20, from Dsuite.cpp:9: /usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type) regex_replace(const basic_string<_Ch_type>& s, ^ /usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template argument deduction/substitution failed: In file included from Dsuite.cpp:13:0: Dsuite_fBranch.h:63:84: note: mismatched types ‘const std::basic_string<_Ch_type>’ and ‘const char [1]’ string treeNoBranchLengths = std::regex_replace(treeString,branchLengths,""); ^ make: *** [Build/Dsuite.o] Error 1

Jiangjiangzhang6 commented 2 years ago

conda install -c conda-forge gxx

did it the error casued by the g++ complier

Immortal2333 commented 1 year ago

conda install -c conda-forge gxx

did it the error casued by the g++ complier

However, there is another bug appearing.

g++ -c -std=c++11 Dsuite.cpp -o Build/Dsuite.o g++ -c -std=c++11 Dsuite_utils.cpp -o Build/Dsuite_utils.o g++ -c -std=c++11 D.cpp -o Build/D.o g++ -c -std=c++11 gzstream.cpp -o Build/gzstream.o g++ -c -std=c++11 Dmin.cpp -o Build/Dmin.o g++ -c -std=c++11 Dmin_combine.cpp -o Build/Dmin_combine.o g++ -c -std=c++11 Dsuite_fBranch.cpp -o Build/Dsuite_fBranch.o g++ -c -std=c++11 Dquartets.cpp -o Build/Dquartets.o g++ -c -std=c++11 Dsuite_common.cpp -o Build/Dsuite_common.o Dsuite_common.cpp: In function 'int assignNumLinesToAnalyse(int, int, const std::string&)': Dsuite_common.cpp:124:45: error: 'istream_iterator' is not a member of 'std' 124 | VCFlineCount = (int)std::count(std::istream_iterator(vcfFile),std::istream_iterator(),'\n'); | ^~~~ Dsuite_common.cpp:9:1: note: 'std::istream_iterator' is defined in header ''; did you forget to '#include '? 8 | #include "Dsuite_common.h" +++ |+#include 9 | Dsuite_common.cpp:124:62: error: expected primary-expression before 'char' 124 | VCFlineCount = (int)std::count(std::istream_iterator(vcfFile),std::istream_iterator(),'\n'); | ^~~~ Dsuite_common.cpp:124:83: error: 'istream_iterator' is not a member of 'std' 124 | VCFlineCount = (int)std::count(std::istream_iterator(vcfFile),std::istream_iterator(),'\n'); | ^~~~ Dsuite_common.cpp:124:83: note: 'std::istream_iterator' is defined in header ''; did you forget to '#include '? Dsuite_common.cpp:124:100: error: expected primary-expression before 'char' 124 | VCFlineCount = (int)std::count(std::istream_iterator(vcfFile),std::istream_iterator(),'\n'); | ^~~~ make: *** [Build/Dsuite_common.o] Error 1