Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error #92

Closed
fdecarpentier opened this issue Feb 28, 2024 · 1 comment · Fixed by #95
Closed

Compilation error #92

fdecarpentier opened this issue Feb 28, 2024 · 1 comment · Fixed by #95

Comments

@fdecarpentier
Copy link

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

@Fan-iX
Copy link
Contributor

Fan-iX commented Mar 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants