I am following a book on c++ and I have got stuck with this. There is a separate .h file with the add function in it and a .cpp file with a main function in it.
My code is identical to whats in the book but I get this error:
In file included from guard.cpp:2:0:
triple.h:3:21: error: 'triple' declared as an 'inline' variable
inline int triple (x) {return add(x, add(x, x));}
And then lots of other errors similar to it.
Below is the code in the triple.h header file. Please help!
inlineint triple (x) {return add(x, add(x, x));}
This looks like some kind of messed up preprocessor macro masquerading as a function, and I'm not surprised it doesn't compile.
If it was a function, it would have the type of that input parameter in there: inlineint triple (int x) {return add(x, add(x, x));}