creationix / dukluv

LibUV bindings for duktape JS engine
http://dukluv.io
MIT License
266 stars 36 forks source link

DukLuv fails to compile using VS2015 #18

Closed fatcerberus closed 8 years ago

fatcerberus commented 8 years ago

I was unable to build dukluv from a fresh checkout using Visual Studio 2015. After running CMake and opening the resulting solution file, I get the following syntax error when attempting to compile it:

4>c:\src\dukluv\src\duv.h(12): error C2059: syntax error: 'constant'

On this line:

typedef enum { false, true } bool;

I believe VS2013 and later include C99 bool via stdint.h, so that's likely the cause of this.

creationix commented 8 years ago

Can I wrap this in an #ifdef? I'm not sure how this is supposed to work.

Another idea is just to #include <stdbool.h> if we can assume it exists.

fatcerberus commented 8 years ago

I believe VS2013 and later includes stdbool.h. I'd recommend:

#if _MSC_VER >= 1800
#include <stdbool.h>
#else
typedef enum { false, true } bool;
#endif
creationix commented 8 years ago

Sounds good. Did you want to send a PR?

fatcerberus commented 8 years ago

Sure. :)