您的位置:首页 > 其它

GDI+: error C2660: 'new' : function does not take 3 parameters--MFC

2011-12-27 16:14 471 查看
在用GDI+写程序时,有
bmp = new Bitmap(L"E:\\1.png");
用VC6 SP6或VS2005编译错误为error C2660: 'new' : function does not take 3 parameters
这是VC的一个BUG,微软至今还没有解除。
解决办法如下:
法一:在该CPP文件开头部分注释掉#define
new DEBUG_NEW

[align=left]#ifdef _DEBUG[/align]
[align=left]//#define new DEBUG_NEW[/align]
[align=left]#undef THIS_FILE[/align]
static charTHIS_FILE[]
= __FILE__;
#endif
建议法二:在GdiplusBase.h文件中class GdiplusBase中添加如下代码
//////////////////////////////////////////////////////////////////////////

void * (operator new)(size_t nSize, LPCSTR lpszFileName, int nLine)

{

return DllExports::GdipAlloc(nSize);

}

void operator delete(void* p, LPCSTR lpszFileName, int nLine)

{

DllExports::GdipFree(p);

}

//////////////////////////////////////////////////////////////////////////
引用自http://www.cnblogs.com/carekee/articles/2038116.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐