【IDE-Visual Studio】warning C4482: nonstandard extension used: enum 'x' used in qualified name

1>------ 已启动生成: 项目: SageMiniGel, 配置: Debug Win32 ------
1>正在编译...
1>WaitProgress.cpp
1>e:\赛智工作项目\sageminigel\sourse\waitprogress.cpp(287) : warning C4482: nonstandard extension used: enum 'Gdiplus::LineCap' used in qualified name
1>e:\赛智工作项目\sageminigel\sourse\waitprogress.cpp(288) : warning C4482: nonstandard extension used: enum 'Gdiplus::LineCap' used in qualified name
1>正在链接...
1>正在嵌入清单...
1>生成日志保存在“file://e:\赛智工作项目\SageMiniGel\temp\2005_Debug\BuildLog.htm”
1>SageMiniGel - 0 个错误,2 个警告
========== 生成: 1 已成功, 0 已失败, 0 最新, 0 已跳过 ==========

其中gdiplus.h文件定义形式如下:

namespace Gdiplus
{
    #include "GdiplusEnums.h"
};

其中GdiplusEnums.h文件定义形式如下:

enum LineCap
{
    LineCapFlat             = 0,
    LineCapSquare           = 1,
    LineCapRound            = 2,
    LineCapTriangle         = 3,
    LineCapNoAnchor         = 0x10, // corresponds to flat cap
    LineCapSquareAnchor     = 0x11, // corresponds to square cap
    LineCapRoundAnchor      = 0x12, // corresponds to round cap
    LineCapDiamondAnchor    = 0x13, // corresponds to triangle cap
    LineCapArrowAnchor      = 0x14, // no correspondence
    LineCapCustom           = 0xff, // custom cap
    LineCapAnchorMask       = 0xf0  // mask to check for anchor or not.
};

其中,调用代码如下:

myPen.SetStartCap(LineCap::LineCapRound);
myPen.SetEndCap(LineCap::LineCapRound);
解决方案:

myPen.SetStartCap(Gdiplus::LineCapRound);
myPen.SetEndCap(Gdiplus::LineCapRound);

原理:LineCap枚举其实就定义在Gdiplus的命名空间内,在Gdiplus命名空间内调用LineCap的枚举不用使用LineCap::,而Gdiplus命名空间外调用LineCap的枚举不用使用LineCap::,使用Gdiplus::枚举的限定 就Ok了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值