ARGB 未在默认 MFC 项目中定义

ARGB is not defined in a default MFC project

要复制:

  1. 启动 VS2019(与 VS2015 相同的问题)。
  2. 创建一个 MFC 项目,命名为 argb-test,然后按完成以使用默认设置。
  3. argb-test.cpp里面,在最后一个include后面加上:

    #include <gdipluspixelformats.h>
    ARGB x;
    
  4. 编译

编译失败,我不知道为什么。这是输出:

test-argb.cpp(16,7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
test-argb.cpp(16,6): error C2146: syntax error: missing ';' before identifier 'x'

将鼠标悬停在 ARGB 上会给我:

所以我觉得还不错。有什么想法吗?

使用命名空间 Gdiplus。

Gdiplus::ARGB x;