CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2001
    Location
    USA
    Posts
    298

    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

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    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.
    Last edited by Eri523; January 28th, 2013 at 04:13 PM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Jun 2001
    Location
    USA
    Posts
    298

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured