meltwater / served

A C++11 RESTful web server library
MIT License
710 stars 173 forks source link

Syntax errors in `request_parser.hpp` when including `served/served.hpp` #60

Open ghostravenstorm opened 5 years ago

ghostravenstorm commented 5 years ago

I added this as a submodule to another program I'm designing to be a rest api so I don't have to futz with building dependencies separately. The following I added to my cmakelists

include_directories(served/src)

And when I include served/served.hpp and do nothing else - I have just an empty main, I get a ton of syntax errors from request_parser.hpp

served\src\served/request_parser.hpp(59,39): error C2143:  syntax error: missing '}' before 'constant'
served\src\served/request_parser.hpp(59,39): error C2059:  syntax error: 'constant'
served\src\served/request_parser.hpp(59,45): error C2143:  syntax error: missing ';' before '}'
served\src\served/request_parser.hpp(59,45): error C2238:  unexpected token(s) preceding ';'
served\src\served/request_parser.hpp(61,1): error C2059:  syntax error: 'private'
served\src\served/request_parser.hpp(84,1): error C2059:  syntax error: 'protected'
served\src\served/request_parser.hpp(95,36): error C2575:  'http_field': only member functions and bases can be virtual
served\src\served/request_parser.hpp(95,38): error C2059:  syntax error: 'constant'
served\src\served/request_parser.hpp(105,19): error C2575:  'request_method': only member functions and bases can be virtual
served\src\served/request_parser.hpp(105,21): error C2059:  syntax error: 'constant'
served\src\served/request_parser.hpp(115,19): error C2575:  'request_uri': only member functions and bases can be virtual
served\src\served/request_parser.hpp(115,21): error C2059:  syntax error: 'constant'
served\src\served/request_parser.hpp(125,19): error C2575:  'fragment': only member functions and bases can be virtual
served\src\served/request_parser.hpp(125,21): error C2059:  syntax error: 'constant'
served\src\served/request_parser.hpp(135,19): error C2575:  'request_path': only member functions and bases can be virtual
served\src\served/request_parser.hpp(135,21): error C2059:  syntax error: 'constant'
served\src\served/request_parser.hpp(145,19): error C2575:  'query_string': only member functions and bases can be virtual
served\src\served/request_parser.hpp(145,21): error C2059:  syntax error: 'constant'
served\src\served/request_parser.hpp(155,19): error C2575:  'http_version': only member functions and bases can be virtual
served\src\served/request_parser.hpp(155,21): error C2059:  syntax error: 'constant'
served\src\served/request_parser.hpp(165,19): error C2575:  'header_done': only member functions and bases can be virtual
served\src\served/request_parser.hpp(165,21): error C2059:  syntax error: 'constant'
served\src\served/request_parser.hpp(171,17): error C2059:  syntax error: ')'
served\src\served/request_parser.hpp(176,25): error C2588:  '::~request_parser': illegal global destructor
served\src\served/request_parser.hpp(176,27): error C2575:  'request_parser': only member functions and bases can be virtual
served\src\served/request_parser.hpp(176,27): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
served\src\served/request_parser.hpp(198,19): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
served\src\served/request_parser.hpp(198,19): error C2365:  'served::status': redefinition; previous definition was 'namespace'
served\src\served/status.hpp(112): message :  see declaration of 'served::status'
served\src\served/request_parser.hpp(198,9): error C2146:  syntax error: missing ';' before identifier 'get_status'
served\src\served/request_parser.hpp(201,1): error C2059:  syntax error: '}'
served\src\served/request_parser.hpp(201,1): error C2143:  syntax error: missing ';' before '}'
served\src\served/request_parser_impl.hpp(31,18): error C2143:  syntax error: missing ';' before '{'
served\src\served/request_parser_impl.hpp(31,18): error C2447:  '{': missing function header (old-style formal list?)
served\src\served/net/connection.hpp(62,46): error C3646:  '_request_parser': unknown override specifier
served\src\served/net/connection.hpp(62,46): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int

I'm building this in Visual Studio 2019. Is Served compatible with on Windows, or it is only Linux and Mac? I assumed since it's using Boost, I could compile it on Windows.

rkoslowski commented 4 years ago

Hello ghostravenstorm,

unfortunately i am forced to use Windows as well, receiving the same errors. I am building this with MinGW on Windows (the not properly working one) but i tested served on Mac too, which compiled sucessfully. I am very aware of your problem being over one year old, but have you worked out any solution for this or solved this problem somehow?