Reputation: 2185
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?
Upvotes: 3
Views: 1793
Reputation: 14119
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.
Upvotes: 3
Reputation: 146920
You defined a structure DeltaKinematics::workingPoint
, and then tried to return a structure workingPoint
. You need the explicit qualification.
Upvotes: 3