加了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了
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/wwyyxx26/archive/2010/09/16/5889041.aspx