grantila / q

A platform-independent promise library for C++, implementing asynchronous continuations.
http://libq.io
Apache License 2.0
192 stars 24 forks source link

Bug: cannot include windows.h anymore #9

Closed rogierschouten closed 7 years ago

rogierschouten commented 7 years ago

I cannot compile my code if both Q and windows.h are included. Most likely there is a visual C++ reserved word used in exception.hpp

input:

#include <windows.h>
#include <q/promise.hpp>

int main(int argc, char** argv)
{
}

output:

1>------ Build started: Project: tryout, Configuration: Debug x64 ------
1>  main.cpp
1>3rdparty\q\include\q\exception\exception.hpp(89): error C2332: 'class': missing tag name
1>3rdparty\q\include\q\exception\exception.hpp(89): error C3306: 'q::detail::<unnamed-tag>': unnamed class template is not allowed
1>3rdparty\q\include\q\exception\exception.hpp(89): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
grantila commented 7 years ago

Indeed, lovely generic lowercase-only name they managed to give a macro!

excpt.h: #define exception_info (struct _EXCEPTION_POINTERS*)_exception_info

grantila commented 7 years ago

While fixing this, I stumbled upon more macro issues with MSVC; You'll need to compile with #define NOMINMAX before including windows.h. Otherwise it will pollute all code with lowercase macros min and max which conflicts with STL code.