Issue with Boost

Im getting a compiler error with boost:


1>------ Build started: Project: boost test, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
1>- add -D_WIN32_WINNT=0x0501 to the compiler command line; or
1>- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.
1>Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
1>Linking...
1>Embedding manifest...
1>Build log was saved at "file://c:\Users\alan\Desktop\boost test\boost test\Debug\BuildLog.htm"
1>boost test - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


Not really sure what to do although I have tried putting #define _WIN32_WINNT 0x0501 under my includes but no luck. Can anyone help?
Build: 1 succeeded, 0 failed,

It compiled fine, are you experiencing some run-time failures?
That's a compiler warning. Unless your target is a version of Windows older than XP, you can safely ignore it.
If you don't want to see it anymore, either define the macro *before* including the header, or add
/D "_WIN32_WINNT=0x0501" to your compiler options.
Last edited on
mcleano wrote:
I have tried putting #define _WIN32_WINNT 0x0501 under my includes

Perhaps it would be better if you put it before your includes. Maybe in some header files there are checks like #ifdef _WIN32_WINNT or #if _WIN32_WINNT==0x0501 etc... It compiles fine because your IDE (or the compiler?) is kind enough to define it for you:

mcleano's IDE (or compiler?) wrote:
1>Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).

EDIT: I've been writing this for 10 minutes, seriously :D Formatting the text properly, using tags can take a lot of time :P It took me quite a while to figure out how to do this one -> mcleano's IDE (or compiler?) wrote:
You can't do it with the usual quote tag because the '\'' breaks it.
Last edited on
It compiles fine because your IDE is kind enough to define it for you
It's the exact opposite. The fact that that message appear means that the compiler, or anyone else for that matter, isn't defining the macro. Boost needs it, so when it sees that it isn't defined, it defines it with a reasonable value.
Ah, ok. So, I guess it's something like:

1
2
3
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif 

inside some boost header...
Last edited on
Helios wrote:
/D "_WIN32_WINNT=0x0501" to your compiler options.

Sorry, but how do you do that on Visual Studio? I'm assuming that code was for compiling via command line.

EDIT** And yes, the #define before the headers worked, thank you.
Last edited on
Properties > C/C++ > Command Line
Topic archived. No new replies allowed.