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

Xiaokui third-party compilation error #7

Open
kamadforge opened this issue Jan 31, 2020 · 5 comments
Open

Xiaokui third-party compilation error #7

kamadforge opened this issue Jan 31, 2020 · 5 comments

Comments

@kamadforge
Copy link

kamadforge commented Jan 31, 2020

While running ./setup.sh, and in particular xiaokui setup.sh, I get the following compilation error:

Utilities.cpp:33:11: note: ‘std::ifstream {aka std::basic_ifstream}’ is not derived from ‘const std::istreambuf_iterator<_CharT, _Traits>’
if(in == NULL){

I think everything is properly set-up before. What could be the problem?

@kamadforge kamadforge changed the title Compilation error Xiaokui third-party compilation error Jan 31, 2020
@bissias
Copy link

bissias commented Feb 3, 2020

Could you please post the entire stack trace?

Also, what platform are you on and what version of c++ compiler are you using?

@SiQube
Copy link

SiQube commented Feb 3, 2020

I found a quick fix for the stated problem. The version used was C++ 11. The problem then was that in Utilities.cpp this part:

void Utilities::readFile(const string file_name, vector<double>& histogram){
	ifstream in(file_name.c_str(), ios_base::in);
	if(in == NULL){
		cout << "Error:open data file error.\n";
		getchar();
		exit(0);        
	}
	string str;
	const string delimiters = " ";
	getline(in, str);
	tokenize(str, histogram, delimiters);
} 

which has to be reformulated in versions 11 and higher to:

void Utilities::readFile(const string file_name, vector<double>& histogram){
	ifstream in(file_name.c_str(), ios_base::in);
	if(!in){
		cout << "Error:open data file error.\n";
		getchar();
		exit(0);        
	}
	string str;
	const string delimiters = " ";
	getline(in, str);
	tokenize(str, histogram, delimiters);
} 

@bissias
Copy link

bissias commented Feb 3, 2020 via email

@juanmigutierrez
Copy link

Thanks @SiQube ! I would never find how to solve that error.

@yuxincs
Copy link

yuxincs commented Feb 16, 2021

Thanks a lot for the fix @SiQube !

A PR about this patch would be awesome.

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

No branches or pull requests

5 participants