Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"WinSock.h has already been included" #155

Closed
radj307 opened this issue Mar 4, 2024 · 1 comment
Closed

"WinSock.h has already been included" #155

radj307 opened this issue Mar 4, 2024 · 1 comment

Comments

@radj307
Copy link

radj307 commented Mar 4, 2024

The order in which you include stacktrace.hpp & asio.hpp can cause a compilation error on Windows.
I tested this on MSVC 19.34.31947 with Boost 1.84.0.

For example, this code doesn't compile:

#include <boost/stacktrace/stacktrace.hpp>
#include <boost/asio.hpp>

This is the error message:

boost\asio\detail\socket_types.hpp(24): fatal error C1189: #error:  WinSock.h has already been included

It compiles fine if you swap the order:

#include <boost/asio.hpp>
#include <boost/stacktrace/stacktrace.hpp>

The same code compiles without issue on Linux (tested with gcc 10 on Debian 11).
This isn't really a huge problem as all you have to do to fix it is include socket_types.hpp before stacktrace.hpp, but the inconsistency is weird when cross-compiling.

@apolukhin
Copy link
Member

Let's continue with this problem in chriskohlhoff/asio#1441

@apolukhin apolukhin closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants