Page 1 of 1

VS2010 fatal error C1189

Posted: Thu Sep 13, 2012 5:39 pm
by zaksoft
Upgrading source from 2.00.2648 to 2.00.2661 I've got this error on VS2010:

RCF\include\RCF/external/asio/asio/detail/socket_types.hpp(22): fatal error C1189: #error : WinSock.h has already been included

Searching on net I've found the causes, but I'm not able (already using WIN32_LEAN_AND_MEAN - other errors putting winsok2.h on top of stdafx.h) to avoid the problem.

Can someone have found a solution ?

TIA

[Solved]: VS2010 fatal error C1189

Posted: Fri Sep 14, 2012 2:03 pm
by zaksoft
since when adding RCF.cpp to a project this file is marked as "Not Using Precompiled Headers", the line

#ifdef __MSC_VER
#define WIN32_LEAN_AND_MEAN
#endif

must be inserted in RCF.cpp before <boost/config>

This solve the problem.

Re: VS2010 fatal error C1189

Posted: Wed Oct 17, 2012 11:21 pm
by jarl
Yes, you will generally need to have WIN32_LEAN_AND_MEAN defined, when building on Windows. In build 2664, I've changed the error message that emanates from Boost.Asio, to indicate this.

The easiest way to deal with this is to specify WIN32_LEAN_AND_MEAN in your build settings (pass -DWIN32_LEAN_AND_MEAN in as a command line option to the compiler), that way you won't have to modify the source.