I have some enum defined like (in header):
typedef enum { METHOD, URL, URL_PARAM, URL_VALUE, VERSION, HEADER_KEY, HEADER_VALUE, BODY, OK } http_request_parser_state;
I try to create such function (in Cpp file):
http_request_parser_state class_name::parse_buffer( http_request_parser_state parser_state)
{
return parser_state;
}
But I get errors like:
Error 1 error C2143: syntax error : missing ';' before 'parse_buffer'
Error 5 error C2371: 'parse_buffer' : redefinition; different basic
etc
So how to define enum so it would be returnable and function argument at the same time?
Isn’t your typedef, by chance, declared inside a class? If so – you should write
class_name::http_request_parser_state class_name::parse_buffer( http_request_parser_state parser_state)