What does "candidate function(s) not accessible" mean?
I have a new managed C++ Form project (my first) and if I try to declare a StreamReader object I get an error that I don't understand:
Code:
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
StreamReader sr;
}
This generates an error on compiling:
error C3767: 'System::IO::StreamReader::StreamReader': candidate function(s) not accessible c:\my documents\visual studio 2008\projects\windowsforms\windowsforms\Form1.h
Can someone explain what this means please?
Thanks
Re: What does "candidate function(s) not accessible" mean?
You're trying to default-construct a StreamReader object. That class does have a default constructor, inherited from TextReader, but it's protected, so you can't access it from your code. That leads to the irritating error message you got instead of a plain "that doesn't exist". Use one of the several public StreamReader constructors instead.
Re: What does "candidate function(s) not accessible" mean?
Thank you very much. The MSDN explanation for this error is more cryptic than the error message.