I am having trouble setting up my functions in a class when I want to have a function return a vector of type struct which I have just defined. Compiler gives a “Use of undeclared identifier” error.
In the .h file: (no errors given)
struct workingPoint;
public:
vector<workingPoint>calculateWorkingPointCloud();
And in the .cpp file:
struct DeltaKinematics::workingPoint {
int x, y, z;
//more stuff to come
};
vector<workingPoint> DeltaKinematics::calculateWorkingPointCloud(){ //error here is "Use of undeclared identifier 'workingPoint'
}
It seems that the compiler doesn’t know what a workingPoint is, despite the fact it is declared before the function?
It is simply a problem of the lookup. You need to fully qualify the name, e.g.
vector<DeltaKinematics::workingPoint> DeltaKinematics::calculateWorkingPointCloud(){...I asked a similar question about this issue here. Maybe it is also interesting for you.