the class constructor declaration in .hpp:
physicsBody(float m, std::vector<float> verts, std::vector<float> initPos, std::vector<float> initVelo);
the class variable declaration in .hpp:
ParticleSystem body;
float mass;
std::vector<float> vertices;
std::vector<float> initialPos;
std::vector<float> initialVelo;
the class constructor implementation in .cpp:
physicsBody::physicsBody(float m,
std::vector<float> verts,
std::vector<float> initPos,
std::vector<float> initVelo):
mass{m}, vertices{verts}, initialPos{initPos}, initialVelo{initVelo}
{
build_body();
// Gravity is enabled as defalut
for (auto& particle : body.pSystem) particle.force[1] = -GRAVITY * particle.m;
}
In Main():
float mass {2.0}; // in kg
std::vector<float> initialPos = {0.0, 0.0, 0.0};
std::vector<float> initialVel = {0.0, 0.0, 0.0};
std::vector<float> verts = ball.vertices;
physicsBody myball(mass, verts, initialPos, initialVel);
When I build, it gives me this error:
"physicsBody::physicsBody(float, std::__1::vector<float, std::__1::allocator >, std::__1::vector<float, std::__1::allocator >, std::__1::vector<float, std::__1::allocator >)", referenced from: _main in main.o
After a few searches, the error can come from the class instantiation does not match the definition, or declaration does not match implementation. I have been scratching my head in the past a few hours. Cannot fix it! My head must have been stuck in the somewhere! Could someone please help! Thanks in advance!