I’m creating a web service using gSoap, in the header file I have few method definitions that their return type is enum value.
When I’m executing the soapcpp2.exe tool and passing with the header file I’m getting this error:
sample.h(20): syntax error
sample.h(21): Syntax error: input before ; skipped
In addition, if I have more than one method with the enum as the return value I’m getting this warning:
**WARNING**: Duplicate declaration of 'sample_status_____' (already declared at li
ne 31), changing conflicting identifier name to new name sample_status______'. Note: this problem may be caused by importing invalid XML schemas (detected at line 38 in sample.h)
My header file looks such like:
// enum definition
enum status {ok, error};
// method definition
status ns_calc(int a, int b);
Is it a limitation with soapcpp.exe?
The header file you are writting has to follow some gSoap conventions. Therefore the output of the function has to be the last argument. From the documentation:
The relevant part in the header file would look like:
Note that this example explicitly uses XML-Schema (
xsd__) types, this practice is advised to improve interoperability. The relevant part in the cpp file would look like: