1

ソリューションのターゲットを SDK バージョン 10.0 (最新のインストール バージョン) (10.0.18362) に変更し、プロジェクトをプラットフォーム ツールセット v142 にアップグレードした後、次のようにwinnt.hでコンパイル時エラーが発生します。

...\Windows Kits\10\Include\10.0.18362.0\um\winnt.h(18611,19): error C2143: syntax error: missing ':' before 'constant'
...\Windows Kits\10\Include\10.0.18362.0\um\winnt.h(18611,22): error C2143: syntax error: missing ';' before ':'
...\Windows Kits\10\Include\10.0.18362.0\um\winnt.h(18611,22): error C2059: syntax error: ':'
...\Windows Kits\10\Include\10.0.18362.0\um\winnt.h(18612,29): error C2143: syntax error: missing '{' before ':'
...\Windows Kits\10\Include\10.0.18362.0\um\winnt.h(18612,29): error C2059: syntax error: ':'
...\Windows Kits\10\Include\10.0.18362.0\um\winnt.h(18613,9): error C2059: syntax error: '}'
...\Windows Kits\10\Include\10.0.18362.0\um\winnt.h(18614,5): error C2059: syntax error: '}'
...\Windows Kits\10\Include\10.0.18362.0\um\winnt.h(18615,1): error C2059: syntax error: '}'

これは、純粋にアップグレードの結果として発生します。私は何を間違えたのでしょうか?

4

1 に答える 1

3

CRコードでマクロを次のように定義していたことがわかりました。

#define CR "\r"

Windows SDK ヘッダーの構造体データ メンバーの名前を上書きしていました。

typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY {
    DWORD BeginAddress;
    union {
        DWORD UnwindData;
        struct {
            DWORD Flag : 2;
            DWORD FunctionLength : 11;
            DWORD RegF : 3;
            DWORD RegI : 4;
            DWORD H : 1;
            DWORD CR : 2;           // <-- conflicting member
            DWORD FrameSize : 9;
        } DUMMYSTRUCTNAME;
    } DUMMYUNIONNAME;
} IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY, * PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY;

同じことが、MSFT 開発ボードで助けを求めるこのフェローにも起こりました。

名前を変更する#defineか、SDK のアップグレードを避ける必要があります。

于 2019-11-07T15:12:11.110 に答える