I have a function that creates a vector, then calls a class constructor with that vector as an input, but it returns with an error saying
undefined reference to Class::Class(std::vector<double, std::allocator<double> >)
The class has a constructor for a
std::vector<double>
but not a
std::vector<double, std::allocator<double> >
Some example code:
std::vector<double> x1;
std::vector<double> x2;
std::vector<double> myvec;
double thisX;
for (int i=0; i<x1.size(); i++ {
thisX = x1[i];
myvec.push_back(thisX);
}
for (int i=0; i<x2.size(); i++ {
thisX = x2[i];
myvec.push_back(thisX);
}
Class MyClass( myvec );
// has a constructor for std::vector<double>
// compiler throws the undefined reference to
// Class::Class(std::vector<double, std::allocator<double> >)
Any insight is appreciated! I'm relatively new to C++ if it wasn't obvious.