Closed FabrizioDys closed 4 years ago
Hi @FabrizioDys ,
Are you able to share with me a compilation unit which exhibits the problem, perhaps by a gist or by sharing a link to github or godbolt?
R
Hi @madmongo1 , HERE is the link for MEPP2, I'm a student who's collaborating with one of the developers so the product was already as you see it. The thing that I am doing now is to add another piece of code ( a filter ) for retrieving a file from internet, so, since they were already using Boost libraries, I thought I could use the asio and beast components to achieve the result. The program is kind of complicated so, following @vinniefalco 's suggestion I am still trying to find where "#include
if defined(WINSOCKAPI) && !defined(WINSOCK2API)
error WinSock.h has already been included
endif // defined(WINSOCKAPI) && !defined(WINSOCK2API)
Ho @FabrizioDys ,
I think a better strategy would be to ensure that #include <boost/asio.hpp>
is the first include in any compilation unit that needs it.
If you've created a project from scratch in Visual Studio, you might find that the precompiled header file StdAfx.h
includes winsock?
Hi again.
I looked through the entire solution and there is no "windows.h" included, nor "StdAfx.h", I followed one of the answers of the stackoverflow page @vinniefalco linked me:
instead of including the boost headers I needed I wrote something like this:
ifdef _WIN32
ifdef USE_ASIO
// Set the proper SDK version before including boost/Asio
include
// Note boost/ASIO includes Windows.h.
include <boost/asio.hpp>
include <boost/beast/core.hpp>
include <boost/beast/http.hpp>
include <boost/beast/version.hpp>
include <boost/asio/connect.hpp>
include <boost/asio/ip/tcp.hpp>
else // USE_ASIO
include
endif // USE_ASIO
else // _WIN32
ifdef USE_ASIO
include <boost/asio.hpp>
include <boost/beast/core.hpp>
include <boost/beast/http.hpp>
include <boost/beast/version.hpp>
include <boost/asio/connect.hpp>
include <boost/asio/ip/tcp.hpp>
endif // USE_ASIO
endif //_WIN32
and the error concerning the "WinSock.h" disappeared. Then I tried to do something like this:
using tcp = boost::asio::ip::tcp; namespace http = boost::beast::http;
and I had the following errors:
asio: not a member of boost ip: not a member of boost asio: the symbol on the left of '::' must be a type
and going on for tcp, beast and http too. Do you have any idea what's happening?
It’s difficult to say without having code available to reproduce the problem.
Can you share a minimal project with me on github or godbolt that reproduces the problem?
This is still a problem for me
This is still a problem for me
Could you please provide a minimal reproducible example?
#define WIN32_LEAN_AND_MEAN
before windows.h include solves the issue for me, which probably isn't optimal.
Hi!
I'm trying to use the HTTP request methods provided by this page:
I am actually implementing this to an already done project ( MEPP2 ) that uses graph and iterator components, I generated through CMake the dependencies with the boost library, and I'm "forced" to use version 1.67. The problem I have when I include `#include <boost/beast/core.hpp>
include <boost/beast/http.hpp>
include <boost/beast/version.hpp>
include <boost/asio/connect.hpp>
include <boost/asio/ip/tcp.hpp>`
these ones is "Fatal Error: Winsocket.h" already included. Can anyone help me out? I can send some more informations if needed. Thank you :)
PLEASE DON'T FORGET TO "STAR" THIS REPOSITORY :)
If you rather keep your project secret, feel free to email the author at
<vinnie.falco@gmail.com>
; any private correspondence is treated as confidential.When reporting a bug please include the following:
Version of Beast
You can find the version number in the file
<boost/beast/version.hpp>
, or by using the command "git log -1" in the local Beast repository directory.Steps necessary to reproduce the problem
A small compiling program is the best. If your code is public, you can provide a link to the repository.
All relevant compiler information
If you are unable to compile please include the type and version of compiler you are using as well as all compiler output including the error message, file, and line numbers involved.
The more information you provide the sooner your issue can get resolved!