vendredi 31 juillet 2015

"Undefined reference to..." error without O1 optimization

I get error "undefined reference to..." while I'm trying to compile my project without O1 optimization. To simplify, assume that we have one class with constant and method:

Car.h

class Car {
 void getInfo();
 static constexpr const char * NAME = "sport car";
}

Car.cpp

void Car::getInfo() {
 //When I try to use constant NAME here, I get error "Undefined reference..."
}

I'm using C++11. Where can be the problem?

Aucun commentaire:

Enregistrer un commentaire