-
February 19th, 2017, 07:43 PM
#1
Problem with WINVER compiler constants
Hi,
I try to compile a code (with Visual Studio 2015 and Windows 10) so it can run on Windows XP SP3 or +.
I have declared the following constants on top of my source files :
Code:
#include <WinSDKVer.h>
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#define NTDDI_VERSION 0x05010300
#include <sdkddkver.h>
The compiled executable file runs correctly on Windows 10, but it doesn't run on Windows XP Pro SP3 (version 5.1.2600). I get the following error message when I try to launch the executable file : "C:\...\text.exe is not a valid Win32 application".
Could someone help me to solve my problem ?
Thanks
-
February 20th, 2017, 03:12 AM
#2
Re: Problem with WINVER compiler constants
To compile for XP, you need to set the Platform Toolset to be Windows XP. Project/Properties/General/Platform Toolset.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
February 22nd, 2017, 07:00 PM
#3
Re: Problem with WINVER compiler constants
That was the solution !... It works well now.
Thank you very much 2kaud !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|