Question:

With Solution Platforms set to WM 6.5.3 Professional DTK (ARMV4I), why does Visual Studio raise the below listed errors as I compile the following basic program?

#include <Windows.h>
#include "PtxKeyboard.hpp"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
       LPTSTR lpCmdLine, int nCmdShow)
{
 return ERROR_SUCCESS;
}

Error list

+----+-------------------------------------------------------------------+-----------------+------+
|  # | Description                                                       | File            | Line |
|----+-------------------------------------------------------------------+-----------------+------|
|  1 | error C2143: syntax error : missing '}' before 'constant'         | PtxKeyboard.hpp |  475 |
|  2 | error C2143: syntax error : missing ';' before 'constant'         | PtxKeyboard.hpp |  475 |
|    | ...                                                               | ...             |  ... |
| 20 | error C2059: syntax error : '}'                                   | PtxKeyboard.hpp | 1475 |
| 21 | error C2143: syntax error : missing ';' before '{                 | main.cpp        |    6 |
| 22 | error C2447: '{' : missing function header (old-style formal list | main.cpp        |    6 |
+----+-------------------------------------------------------------------+-----------------+------+

Line 475 of the PtxKeyboard.hpp header file read as follows:

472         enum VirtualKey
473         {
474             VK_None   = 0,
475 »           VK_F25    = 0xF0,
476             VK_F26    = 0xF1,
477             VK_F27    = 0xF2,
478             VK_F28    = 0xF3,
479             VK_F29    = 0xF4,
480             VK_F30    = 0xF5,
481         } ;

--

& With Solution Platforms set to Windows Mobile 6 Professional SDK (ARMV4I), Visual Studio does not raise such errors.


Answer:

The problem comes from the fact that VK_F25 is already defined in the C:\Program Files\Windows Mobile 6.5.3 DTK\PocketPC\Include\Armv4i\winuser.h header file.

I.e. 

Line 3064 of the winuser.h header file reads #define VK_F25 0x88

--

To clear this problem, edit and udpate the PtxKeyboard.hpp header file with one of the below options:

Option Nº 1 : «discard» the PtxKeyboard.hpp header file VK_F25 define

472         enum VirtualKey
473         {
474             VK_None   = 0,
475 #ifndef VK_F25
476             VK_F25    = 0xF0,
477 #endif
478             VK_F26    = 0xF1,
479             VK_F27    = 0xF2,
480             VK_F28    = 0xF3,
481             VK_F29    = 0xF4,
482             VK_F30    = 0xF5,
483         } ;

Option Nº 2 : «supersede» the winuser.h header file VK_F25 define

472         enum VirtualKey
473         {
474             VK_None   = 0,
475 #ifdef VK_F25
476 #undef VK_F25
477 #endif

478             VK_F25    = 0xF0,
479             VK_F26    = 0xF1,
480             VK_F27    = 0xF2,
481             VK_F28    = 0xF3,
482             VK_F29    = 0xF4,
483             VK_F30    = 0xF5,
484         } ;