Hello, I am currently almost finished with the task of setting up FLTK for the book Programming Principles and practice.
I have sucessfully installed FLTK 1.1.9(Tested to see if it works), and I have properly put all the headers and cpp files into a project, which is supposed to make a triangle appear on the screen.
There is 2 errors that I get, and that is:
1 2 3 4
43 error C4616: 'Graph_lib::can_open':must return a value
44 IntelliSense: no suitable conversion function from "std::ifstream" to "bool" exists
Here is the code, where the error appears. It is located in Graph.cpp:
1 2 3 4 5 6 7 8 9 10
//----------------------------------------------------------------------
bool can_open(const string& s)
// check if a file named s exists and can be opened for reading
{
ifstream ff(s.c_str());
return ff;
}
//-----------------------------------------------------------------------