When I attempt to create the function in my cpp file it tells me that a ; is required?
My header file has a struct with the function prototype
class test{public:typedef struct NormalArray{ float normX; float normY; float normZ;}SAMPLE_STRUCT; //function prototype SAMPLE_STRUCT GetNormal();private:};
I am then trying to use this in my cpp file. The cpp file can find the fields and items associated with the struct and seems to be OK except it wont compile.
#include "test.h" SAMPLE_STRUCT GetNormal() { //need ; here? SAMPLE_STRUCT sample_struct; sample_struct.normX = 5; sample_struct.normY = 12; sample_struct.normZ = 20; std::cout<<"sample struct is "<<sample_struct.normX<<std::endl; return sample_struct; }
I am just trying to use a really simple example just to put the values in print the mout then return the struct. I want to them print this out again to ensure that the values are passed correctly etc.
Do I need to pass by reference using pointers? Am I missing something obvious?
Many thanks