I want to define function in class Region but line 4 and 1 (in regio.cpp) doesn't mach what am I missing??
1 2 3 4 5 6 7 8 9
class Region {
public:
Region();
void htonHeader(struct , char ); //error in this line
virtual ~Region();
private:
typedefstruct Header {
uint16_t f1;
}h;
When you declare the function you are not mentioning the complete type names.
struct is not a type. You need to mention the struct type name like you do when you define the function. You also need to define the Header struct before this point (not after). Not sure why you are using typedef when you are defining the struct. It's something you usually see in C but in C++ it's generally not needed.
1 2 3
typedefstruct Header {
uint16_t f1;
}h;
The second parameter is a pointer to a char so you have to state that by writing char*, char[], or char[8]. Note that the size 8 is ignored by the compiler so there isn't really much point writing it out.