我candidate function(s) not accessible在调用某些成员时遇到编译错误,尽管我将它们声明为public.当涉及来自vtk的某个类(作为返回类型或参数)并且要调用的类与调用代码不在同一个VS项目中时,我只得到错误.我也试过其他vtk类型没有运气:(
这是一些测试代码:
// A.h, in a seperate class library
#include <vtkActor.h>
public ref class A
{
public:
A(void);
void test1(vtkActor* actor);
vtkActor* test2();
void test3(char* actor);
char* test4();
};
// B.h, Same as A but in the same project as the calling code
#include <vtkActor.h>
ref class B
{
public:
B(void);
void test1(vtkActor* actor);
vtkActor* test2();
void test3(char* actor);
char* test4();
};
Run Code Online (Sandbox Code Playgroud)
我试着从同一个项目中调用函数B是这样的:
// calls to class library
A^ …Run Code Online (Sandbox Code Playgroud)