[OSX 10.12.6, LLVM Clang ++ 9.0]
I need to convert a library written in C++11 (which uses initialisation lists) to C++03 form (or earlier). The library is a header only implementation of a 3D model. In the library, I have a struct that contains a number of properties which themselves are custom classes.
struct BodyPoint {
BodyPoints name;
Point3D<double> orientation;
Point3D<double> offset;
BodyPoint() {}
BodyPoint(BodyPoints _name, Point3D<double> _orientation, Point3D<double> _offset):
name(_name), orientation(_orientation), offset(_offset) {}
};
1) BodyPoints is a typedef enum BodyPoints
that enumerates points of interest on the object I'm controlling. (declared in this library)
2) The Point3D<double> (included from another header)
The library provides a pre-defined array of BodyPoints which is global to the modules that use it.
So, after the declaration of the struct, I am declaring an array variable. However, I'm getting an error declaration requires a global constructor [-Werror,-Wglobal-constructors]
My array declaration is as follows:
static BodyPoint bodyPoints[2] =
{
BodyPoint(bWorld,Point3D<double>(0.0,0.0,0.0), Point3D<double>(0.00,0.00,0.00) ),
BodyPoint(bHead, Point3D<double>(0.0,0.0,0.0), Point3D<double>(0.00,0.00,0.00) )
};
How do I create a constructor for an array of structs and where in my code would I do that? (Also, I don't want to use vectors here.)