Search code examples
assemblyx86visual-studio-2019masmmasm32

MASM 14: constant expected in winextra.inc


There is an opinion on the Internet that these errors are a trouble in MSVC 2019. However I not found how to solve this problem except advice to install another version of MASM.

winextra.inc from include:

; ...
STD_ALERT struct
    alrt_timestamp dd ?
    alrt_eventname WCHAR  [EVLEN + 1] dup(?)  ; Here is A2026
    alrt_servicename WCHAR [SNLEN + 1] dup(?) ; Here is A2026
STD_ALERT ends
; ...

So how to solve errors A2026 in winextra without reinstallation MASM to another version?


Solution

  • Older versions of MASM accepted the syntax. The newer versions require replacing the square brackets with parentheses.

    ; ...
    STD_ALERT struct
        alrt_timestamp dd ?
        alrt_eventname WCHAR  (EVLEN + 1) dup(?)  ; Corrected
        alrt_servicename WCHAR (SNLEN + 1) dup(?) ; Corrected
    STD_ALERT ends
    ; ...