piscisaureus / wepoll

wepoll: fast epoll for windows⁧ 🎭

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WEpoll doesn't compile on VS2017 anymore

thealexparshin opened this issue · comments

WEpoll stopped compiling in the latest Visual Studio 2017.
The error happens on attempt of the compiler detecting CXX 17 compatibility (for C files!):

test-ctl-fuzz.c
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h(212): error C2220: warning treated as error - no 'object' file generated
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h(212): warning C4668: '__cplusplus' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

The workaround I used for now was defining at he beginning of each C file:
#define _CRT_HAS_CXX17 0

I guess that should be possible to define in compiler options in CMakeLists.txt file, but I'm not the Windows man so I leave it to pros :)

Actually, adding an option in CMakeListst.txt worked:

if(MSVC_VERSION GREATER_EQUAL 1900)
add_compile_options(/wd5045 /D _CRT_HAS_CXX17=0)
endif()

@thealexparshin Does this problem also occur in the combined source code in https://github.com/piscisaureus/wepoll/tree/dist?
Or is is it limited from to the cmake build only?

@thealexparshin

I tried to reproduce the problem but I couldn't. This could be because I'm using a different version of the Windows SDK than you (I'm on 10.0.18362.0 which is the latest at the time of writing). On appveyor there seems to be no problem either.

So I suspect that the issue was caused by a one-off SNAFU with a particular version of the windows SDK that has been fixed by Microsoft since.

That said, thanks for reporting the bug, if you run into any other issues please let me know.

I'm not sure about the rest of this issue here but for the

C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt.h(212): warning C4668: '__cplusplus' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

part, you may just add:

#ifdef _WIN32
#pragma warning (disable : 4668)
#endif

at your headers.