Error with constructor's prototype not found with dyn mem allocation

Hello I recently was trying to copy the content of a vector of the kind "Triangle" to a dynamically allocated array of the same kind.

For such, first I created this code:

1
2
3
4
void Scene::setTriMem () {
   tri_arr = new Triangle [triangle_container.size()];
   cout << triangle_container.size() << endl;
}


where tri_arr is a Triangle* tri_arr;

Until there no problem:

Then I created the copy code:

1
2
3
4
void Scene::copyTriangles () {
   for (int i=0; i<triangle_container.size(); i++)
      tri_arr [i] = triangle_container[i];
}


that gave me this error code
/home/leopoldo/asmfrtSource/Scene.cpp|211|error: no matching function for call to ‘Triangle::Triangle()’|
note: candidates are: Triangle::Triangle(Vec3f&, Vec3f&, Vec3f&, int)|
note: Triangle::Triangle(const Triangle&)|


Then I decided to create a empty constructor, since there was only the one that receives "Vec3f" as parameters:

1
2
3
Triangle::Triangle () {

}


but now I receive

error: prototype for ‘Triangle::Triangle()’ does not match any in class ‘Triangle’|
error: candidates are: Triangle::Triangle(const Triangle&)|
error: Triangle::Triangle(Vec3f&, Vec3f&, Vec3f&, int)|


What shall I do? Thanks for your time
Add Triangle();
inside the existing declaration
1
2
3
4
class Triangle()
{
...
}
Add Triangle();
inside the existing declaration

class Triangle()
{
...
}


Thanks.
Topic archived. No new replies allowed.