Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.15k stars 93 forks source link

Visual Studio 2017 Compilation Error #33

Closed webfolderio closed 5 years ago

webfolderio commented 5 years ago

Hi,

I am unable to compile restinio.

Here is my configuration:

c:\tools\vcpkg\installed\x64-windows-static\include\restinio\sendfile.hpp(321): error C2589: '(': illegal token on right side of '::' 
c:\tools\vcpkg\installed\x64-windows-static\include\restinio\sendfile.hpp(321): error C2059: syntax error: ')' 
c:\tools\vcpkg\installed\x64-windows-static\include\restinio\sendfile.hpp(346): error C2589: '(': illegal token on right side of '::' 
c:\tools\vcpkg\installed\x64-windows-static\include\restinio\sendfile.hpp(346): error C2059: syntax error: ')' 
eao197 commented 5 years ago

It looks like the problem with the definition of min and max macros in windows.h header. Try to define:

#define NOMINMAX

before inclusion of windows.h or RESTinio header files. Something like:

#define NOMINMAX
#include "pch.h"
#include <restinio/all.hpp>
webfolderio commented 5 years ago

It works now, thanks