.cpp files are compiled, .h files are not. This is why you include h files into cpp files and not the other way around. bringing cpp files together is the job of the linker, which you need not be too concerned with.
Another error gone! Now, I still have this error that I can't figure out:
/home/werner/c++workspace/Pinball/Entities.h|31|error: no match for ‘operator=’ in ‘((StaticWall*)this)->StaticWall::drawList.std::vector<_Tp, _Alloc>::operator[] [with _Tp = Drawable, _Alloc = std::allocator<Drawable>](((unsigned int)i)) = line’|
class StaticWall : Entity{
std::vector<Drawable> drawList;
StaticWall(b2Vec2 vertices[], int vertex_amount, b2World & physics_world){
b2BodyDef bodyDef;
bodyDef.type = b2_staticBody;
bodyDef.position.Set(0,0);
b2Body * body = physics_world.CreateBody(&bodyDef);
b2ChainShape chain;
chain.CreateChain(vertices, vertex_amount);
b2FixtureDef fixtureDef;
fixtureDef.shape = &chain;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.3f;
body->CreateFixture(&fixtureDef);
for (int i=0; i<vertex_amount-1;i++){
Drawable_Line line(vertices[i].x,vertices[i].y,vertices[i+1].x,vertices[i+1].y);
drawList[i] = line; // <-- Compiler error here
}
}
void draw_self(){
for (unsigned i=0; i < drawList.size(); i++) {
drawList[i].draw();
}
}
}
EDIT: Nevermind, something went wrong so that Drawable_Line was not a child of Drawable. It's working now. Thanks for helping me with those other errors though!