CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2017
    Posts
    4

    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

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    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)

  3. #3
    Join Date
    Feb 2017
    Posts
    4

    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
  •  





Click Here to Expand Forum to Full Width

Featured