Dsuite
Dsuite copied to clipboard
Compilation error
Thank you very much for this nice software. I had an error while compiling Dsuite_Common.
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<char>(*vcfFile),std::istream_iterator<char>(),'\n');
| ^~~~~~~~~~~~~~~~
Dsuite_common.cpp:9:1: note: ‘std::istream_iterator’ is defined in header ‘<iterator>’; did you forget to ‘#include <iterator>’?
8 | #include "Dsuite_common.h"
+++ |+#include <iterator>
9 |
Dsuite_common.cpp:124:62: error: expected primary-expression before ‘char’
124 | VCFlineCount = (int)std::count(std::istream_iterator<char>(*vcfFile),std::istream_iterator<char>(),'\n');
| ^~~~
Dsuite_common.cpp:124:83: error: ‘istream_iterator’ is not a member of ‘std’
124 | VCFlineCount = (int)std::count(std::istream_iterator<char>(*vcfFile),std::istream_iterator<char>(),'\n');
| ^~~~~~~~~~~~~~~~
Dsuite_common.cpp:124:83: note: ‘std::istream_iterator’ is defined in header ‘<iterator>’; did you forget to ‘#include <iterator>’?
Dsuite_common.cpp:124:100: error: expected primary-expression before ‘char’
124 | VCFlineCount = (int)std::count(std::istream_iterator<char>(*vcfFile),std::istream_iterator<char>(),'\n');
| ^~~~
make: *** [Makefile:13: Build/Dsuite_common.o] Error 1
I managed to solve it by adding #include <iterator> to Dsuite_Common.h
I'm wondering if it is a problem with my gcc version (13.2.1) or if you should modify Dsuite_Common.h in the git repo.
Cheers
I got the same problem with gcc v12.3.1, but not in gcc v10.1.0.
Dsuite_utils.h includes <regex>, which includes <iterator> at least before gcc v10.1.0.
While in gcc v12.3.1, <iterator> is no longer included in <regex>, and causes the problem.