Skip to content

Error in compilation #12

Open
Open

Description

@AlexisPister

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

Activity

  1. changed the title [-]Cannot compile[/-] [+]Error in compilation[/+] on Dec 26, 2020
  2. lunaticbg commented on Jul 23, 2021

    @lunaticbg

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

  3. lunaticbg commented on Jul 26, 2021

    @lunaticbg

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

    return static_cast<bool>(ifile);
  4. TerryLee77 commented on Aug 13, 2021

    @TerryLee77

    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

  5. DRealHammer commented on Nov 18, 2021

    @DRealHammer

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions