C++ CLI error C3767: candidate function(s) not accessible

后端 未结 3 543
余生分开走
余生分开走 2020-11-30 10:20

I\'m new to C++ CLI coming from unmanaged C++ world.

I\'m getting this error:

candidate function(s) not accessible 

when I pass a s

3条回答
  •  悲&欢浪女
    2020-11-30 10:58

    if you simply must access the internal methods another work around would be making the projects as Friend Assemblies like that:

    //Lib Project

    #pragma once
    
    //define LibTest as friend assembly which will allow access to internal members
    using namespace System;
    using namespace System::Runtime::CompilerServices;
    [assembly:InternalsVisibleTo("LibTest")];
    
    public ref class Lib
    {
     public:
      Lib(void);
    
     public:
      void Extract( std::string& data_ );
    };
    

    //LibTest Project

    #pragma once
    
    #using  as_friend
    
    ref class LibTest
    {
      public:
        LibTest(void);
    };
    

提交回复
热议问题