ric*_*chn 0 .net c++-cli vtk visual-c++
我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^ testA = gcnew A();
testA ->test1(vtkActor::New()); // error
testA ->test2(); // error
testA ->test3(""); // ok
testA ->test4(); // ok
// calls to this project
B^ testB = gcnew B();
testB ->test1(vtkActor::New()); // ok
testB ->test2(); // ok
testB ->test3(""); // ok
testB ->test4(); // ok
Run Code Online (Sandbox Code Playgroud)
在带有//错误的两行中,这是确切的消息:
error C3767: 'A::test1': candidate function(s) not accessible
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个错误?为什么它只出现在vtk类型上?
亲切的问候,富裕
| 归档时间: |
|
| 查看次数: |
3552 次 |
| 最近记录: |