[C++ Error] GdiplusGraphics.h(34): E2015 Ambiguity between 'Gdiplus::Graphics::Graphics(void *)' and 'Gdiplus::Graphics::Graphic

今天遇到这个问题

 

在网上找到一篇

 

http://blog.k-res.net/?paged=13

 

一下为引用:

 

 

加了Gdiplus.h后,编译不能通过,提示[C++ Error] GdiplusGraphics.h(37): E2015 Ambiguity between ‘Gdiplus::Graphics::Graphics(void *)’ and ‘Gdiplus::Graphics::Graphics(void *,int)’

这个是CodeGear提到的一个已知问题:

Must Turn off NO_STRICT #define with GdiPlus library

The C++ library GdiPlus cannot be used in non STRICT mode, since it requires that Graphics::Graphics(HDC) be distinguishable from Graphics::Graphics(HWND). In non STRICT mode, both HWND and HDC are “void*”. Otherwise, you get the error:
[C++ Error] GdiplusGraphics.h(37): E2015 Ambiguity between ‘Gdiplus::Graphics::Graphics(void *)’ and ‘Gdiplus::Graphics::Graphics(void *,int)’

解决办法就是在Project->Options里的Paths and Defines的Conditional Defines里面加上STRICT,这样就开启了STRICT模式,那个歧义就可以消除了!

 

 

 

我的环境是2006,

 

1、加入头文件

#include <Gdiplus.h>

 

2、加入预编译命令

#pragma link "gdiplus.lib"

 

3、option->c++ compling->paths and defines里的conditional defines 里加上 STRICT

 

就ok了

 

还要注意的就是有名字空间,该加上的要加上Gdiplus::

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值