I am following along with the Ray Tracing in One Weekend book and I'm getting a weird error even though I've made sure my code is identical to the code listed in the book.
In the vec3 class
class vec3{
public:
// Default constructor (zero vector)
vec3() : e{0,0,0} {}
// Constructor
vec3(double x, double y, double z) : e{x, y, z} {}
// various functions
public:
double e[3];
};
I'm getting this error when compiling:
./vec3.h:12:27: error: expected member name or ';' after declaration specifiers
vec3() : e{0,0,0} {}
^
./vec3.h:12:19: error: expected '('
vec3() : e{0,0,0} {}
Is this something to do with the compiler I'm using (g++) or can any of you spot some type of stupid error I'm making? I'm quite new to C++, this would be my second project with it.