I’m getting this error:
error C3767: 'phys1::point::get_prev': candidate function(s) not accessible
Here’s my code
phys.h
using namespace System;
namespace phys1 {
typedef struct position{
int x;
int y;
} pos;
public ref class point{
public:
point(float speed, float gr);
public:
pos get_prev();
public:
pos get_next();
};
}
phys.cpp
// This is the main DLL file.
#include "phys.h"
using namespace System;
namespace phys1 {
...
static pos point::get_prev(){
pos point;
point.x=x;
point.y=y;
return point;
}
...
}
Is it problem with my struct, which i try to use in library? Can i build it in another way?
If you’re trying to pass values of type
posacross an assembly boundary, it should be a public managed type.public value struct poswould be most appropriate for what you’re doing.Native types aren’t visible across assembly boundaries by default, and the
#pragmathat makes them visible is more of a kludge than a real solution. Just make a proper .NET type with metadata.