[asio]Winsock.h

View: New views
8 Messages — Rating Filter:   Alert me  

[asio]Winsock.h

by Robert Jones-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What's the deal with Winsock.h & Asio?

I can see there's been chatter on this topic before, but not what the
result is.

Thanks, Rob.

_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: [asio]Winsock.h

by Igor R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> What's the deal with Winsock.h & Asio?
>
> I can see there's been chatter on this topic before, but not what the result is.

Could you please mention your Boost version, compiler and the specific
issue you encounter?

Thanks.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: [asio]Winsock.h

by Robert Jones-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jul 7, 2009 at 11:42 AM, Igor R <boost.lists@...> wrote:
> What's the deal with Winsock.h & Asio?
>
> I can see there's been chatter on this topic before, but not what the result is.

Could you please mention your Boost version, compiler and the specific
issue you encounter?

Yeah, sorry, I thought this would instantly ring bells with folks!

Boost 1.38, Vis Studio 2005, and the issue is that unless I put the main
Boost.Asio header first in my #include list I get a failure message

WinSock.h has already been included

from socket_types.hpp.

Thanks, Rob.

_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: [asio]Winsock.h

by Darren Garvey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Robert,

2009/7/7 Robert Jones <robertgbjones@...>
On Tue, Jul 7, 2009 at 11:42 AM, Igor R <boost.lists@...> wrote:
> What's the deal with Winsock.h & Asio?

Boost 1.38, Vis Studio 2005, and the issue is that unless I put the main
Boost.Asio header first in my #include list I get a failure message

WinSock.h has already been included

from socket_types.hpp.

The workaround for this is to #define WIN32_LEAN_AND_MEAN before including the windows header. The problem is really that windows.h includes so much stuff in it.

It looks like Boost.Asio defines WIN32_LEAN_AND_MEAN by default anyway (http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/using.html).

Cheers,
Darren



_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: [asio]Winsock.h

by Commander Pirx :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I was struggling with this problem too. Include <asio.hpp> before
<windows.h> and all works fine.


"Robert Jones" <robertgbjones@...> schrieb im Newsbeitrag
news:4efd67eb0907070616i225bc2f4h7a4a255be2e8bd5d@......
On Tue, Jul 7, 2009 at 11:42 AM, Igor R <boost.lists@...> wrote:

> What's the deal with Winsock.h & Asio?
>
> I can see there's been chatter on this topic before, but not what the
> result is.


Could you please mention your Boost version, compiler and the specific
issue you encounter?


Yeah, sorry, I thought this would instantly ring bells with folks!

Boost 1.38, Vis Studio 2005, and the issue is that unless I put the main
Boost.Asio header first in my #include list I get a failure message

WinSock.h has already been included

from socket_types.hpp.

Thanks, Rob.




_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users 


_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: [asio]Winsock.h

by Zachary Turner-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Tue, Jul 7, 2009 at 7:00 PM, Commander Pirx <CmdPirx@...> wrote:
I was struggling with this problem too. Include <asio.hpp> before <windows.h> and all works fine.


"Robert Jones" <robertgbjones@...> schrieb im Newsbeitrag news:4efd67eb0907070616i225bc2f4h7a4a255be2e8bd5d@......

On Tue, Jul 7, 2009 at 11:42 AM, Igor R <boost.lists@...> wrote:

What's the deal with Winsock.h & Asio?

I can see there's been chatter on this topic before, but not what the result is.


Could you please mention your Boost version, compiler and the specific
issue you encounter?


Yeah, sorry, I thought this would instantly ring bells with folks!

Boost 1.38, Vis Studio 2005, and the issue is that unless I put the main
Boost.Asio header first in my #include list I get a failure message

WinSock.h has already been included

from socket_types.hpp.

Thanks, Rob.

I'm not sure what the specific problem is, but this sounds eerily similar to the issues you encounter when using raw winsock programming without the presence of asio at all.  If it's the problem I'm thinking of, then I'm pretty sure you can get around it by including <winsock2.h> before including <windows.h>. 

Including asio.h first probably works fine too as others have mentioned, but I don't always like to include boost header files in my precompiled headers, especially if most of the logic I'm using from those headers is encapsulated in one or two specific cpp files. 

_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: [asio]Winsock.h

by Jonathan Franklin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jul 7, 2009 at 6:00 PM, Commander Pirx<CmdPirx@...> wrote:
> I was struggling with this problem too. Include <asio.hpp> before
> <windows.h> and all works fine.

This works great, most of the time.

I've got some headers that include the wxWidgets pre-compiled headers
header file, which pretty much blows any previous definitions away,
AND includes windows.h.  I never figured out a way to integrate asio
into this file, and was forced to use the pimpl idiom.

I'm a wx light-weight, so perhaps there is something I missed.

Jon
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: [asio]Winsock.h

by Zachary Turner-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Jul 13, 2009 at 12:36 PM, Jonathan
Franklin<franklin.jonathan@...> wrote:

> On Tue, Jul 7, 2009 at 6:00 PM, Commander Pirx<CmdPirx@...> wrote:
>> I was struggling with this problem too. Include <asio.hpp> before
>> <windows.h> and all works fine.
>
> This works great, most of the time.
>
> I've got some headers that include the wxWidgets pre-compiled headers
> header file, which pretty much blows any previous definitions away,
> AND includes windows.h.  I never figured out a way to integrate asio
> into this file, and was forced to use the pimpl idiom.
>
> I'm a wx light-weight, so perhaps there is something I missed.
>
> Jon

I'm not familiar with wxWidgets, but what do you mean it "blows away
any previous definitions"?  It can't uninclude any file you've
included before the wxWidgets header file.  I tried to download it to
see what you mean, but the wxWidgets sourceforge is giving me errors
when I try to download the latest release, saying the file doesn't
exist.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users