Reputation: 25
I want to define a struct out of the head file.
Below is what I declare in the (*.h)
class MyVertex
{
public:
struct Vertex{};
};
How can I define the struct Vertex more detailedly in the (*.cpp)? I've tried several times with several ways but failed.
Upvotes: 2
Views: 823
Reputation: 755179
The problem here is you are not declaring the struct
you are fully defining it. In order to declare it you need to leave off the {}
class MyVertex {
public:
struct Vertex;
};
Once you do that you will be able to define the struct
members later in the .h
file or the .cpp
struct MyVertex::Vertex {
...
};
Upvotes: 7