Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
missing WINVER variable
kidmosey:
--- Quote from: thomas on July 15, 2006, 10:44:23 am ---I don't know how exactly it is handled in Visual Studio (as I don't use this particular product), but very likely there is a choice box in the project settings that lets you define this variable and which defaults to either nothing or a "reasonably low value".
--- End quote ---
I deleted Visual Studio once I installed C::B *grin*, but if I remember correctly, I think VS does ask you which version of windows you will be compiling for, or at the very least has a dropdown for it hidden somewhere in it's maze of configuration settings. But since C::B is multi-platform, it doesn't seem viable to include "Windows Version" as an option.
Raijinsetsu:
Basically WINVER means you have the set of Windows DLLs corresponding to version X of windows. In all my Visual Studio crawling, I've never seen a compiler flag or setting(on the command line) that sets this macro. Maybe it's hidden from the user? You know MS likes to be tricky, or just plain mean.
However, having read the above posts, I can agree that for the sake of portability, C::B shouldn't automatically set it. However, it should be noted that anyone trying to make cross-platform sockets with CygWin(maybe even with MinGW, I think they have the same includes) and C::B, will have to use obselete and deprecated functions.
gethostbyname, and gethostbyaddr have been deprecated on both linux and windows. Their replacement, getaddrinfo, and it's compliment, freeaddrinfo, will only be available(in a CygWin compile) if WINVER is set >= 0x0501. This is a portability issue because these functions are defined in linux without this.
MortenMacFly:
I believe the WINVER is defined inside some of the plenty header files for the MSVC SDK. Thus it depends on the version of the (platform) SDK you are using. The platform SDK I'm using currently defines WINVER just in Windows.h which you ususally include in your MS projects. Within the platform SDK it is defined to 0x0501, whereas in the SDK of MSVC version 6 (the "old" Visual Studio) it is defined e.g. to WINVER 0x0400.
Thus it depends on what SDK version (version of libs) you are using.
With regards, Morten.
Raijinsetsu:
--- Quote from: MortenMacFly on July 15, 2006, 03:22:29 pm ---I believe the WINVER is defined inside some of the plenty header files for the MSVC SDK. Thus it depends on the version of the (platform) SDK you are using. The platform SDK I'm using currently defines WINVER just in Windows.h which you ususally include in your MS projects. Within the platform SDK it is defined to 0x0501, whereas in the SDK of MSVC version 6 (the "old" Visual Studio) it is defined e.g. to WINVER 0x0400.
Thus it depends on what SDK version (version of libs) you are using.
With regards, Morten.
--- End quote ---
So this means that the missing WINVER macro is actually a problem with CygWin/MinGW... Thanks Mort.
MortenMacFly:
--- Quote from: Raijinsetsu on July 15, 2006, 03:44:39 pm ---So this means that the missing WINVER macro is actually a problem with CygWin/MinGW...
--- End quote ---
Sorry, but no: I don't thinks so. WINVER is defined within windef.h in my MinGW GCC compiler installation. winver.h is included from windows.h which (again) I believe you need to include in any Win32 application you are trying to implement. So please try to change your project in a way it includes windows.h early in the beginning and all your issues should be gone. Please remember: This only applies if you are programming Win32 API. For a MinGW console app or wxWidgets (for example) you don't need to do this (or it is "done by the wxWidgets headers", if needed).
With regards, Morten.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version