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

Error in compilation #12

Open
AlexisPister opened this issue Dec 26, 2020 · 4 comments
Open

Error in compilation #12

AlexisPister opened this issue Dec 26, 2020 · 4 comments

Comments

@AlexisPister
Copy link

AlexisPister commented Dec 26, 2020

Hello,

Thanks for sharing your implementation

However, I cannot compile the program on my computer, I am on Ubuntu 20.04

Here is the error message :

graphlet_utils.cpp: In function ‘bool fexists(const char*)’:
graphlet_utils.cpp:42:12: error: cannot convert ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} to ‘bool’ in return
   42 |     return ifile;
      |            ^~~~~
make: *** [Makefile:47: pgd] Error 1

Thank you for your help

@AlexisPister AlexisPister changed the title Cannot compile Error in compilation Dec 26, 2020
@lunaticbg
Copy link

Do you solve this problem? I also met the bug ...

@lunaticbg
Copy link

I solved it with change the type of ifile into static_cast(ifile);

return static_cast<bool>(ifile);

@TerryLee77
Copy link

I solved it with change the type of ifile into static_cast(ifile);

return static_cast<bool>(ifile);

But I still met the bug after change the type.And here is the erroe message``

I solved it with change the type of ifile into static_cast(ifile);

return static_cast<bool>(ifile);

I tried. But after that I still have problem.And the Error message: collect2: error: ld returned 1 exit status make: *** [Makefile:47:pgd] Error 1

@DRealHammer
Copy link

I solved it with change the type of ifile into static_cast(ifile);

return static_cast<bool>(ifile);

is maybe a bit weird and seems not to work

as the function is only used to verify, if a file exists and can be accessed:

if (!fexists(graph.c_str()) ) { cout << "File not found!" << endl; return; }

we can just change it to the statement

return ifile.is_open();

works for compiling so far

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

4 participants