error C2660: “Gdiplus::GdiplusBase::operator new”: 函数不接受 3 个参数(转)
来源:互联网 发布:网络投票怎么刷票 编辑:程序博客网 时间:2024/05/22 00:25
转自 : http://dragoo747450.blog.163.com/blog/static/16360602012656340227/
环境:xp sp3,vs2008
代码:
//使用了gdi,ImageEx继承于Image
ImageEx* m_image;
m_image = new ImageEx( L"d:\\loading.gif" );
//解决:
方法1,2(不推荐):
http://support.microsoft.com/kb/317799
http://blog.csdn.net/caiboisgreat/article/details/7210380
方法3(不推荐):在GDI+的new操作符前添加::域限定符,如:
Bitmap* temp = ::new Bitmap(L"c:\\1.bmp");
http://hi.baidu.com/heng_nailuo/blog/item/4a67d82a89759b305343c10e.html/cmtid/f41bfcdf451c3d1c6227985d
重要补充:
大牛胡哼哼揭开该问题的本质:
补充下,其实归根结底还是域名的问题!由于各名字空间中有同名的函数或者成员,而在用的时候没很明确的指明来自哪个名字空间,然后就会由于同名,而参数或者是实现不同而出错误。
今天之所以在release下通过编译而debug下无法通过编译是因为release和debug的设置不同,包括其中的链接库,头文件及编译时的设置不一样,所以就.........
而在debug下需要::是因为new在其下就被设置成全局作用域,::前的名字空间就给省略了。如果没有::就会被认为是内部的作用域,就如上面文档所说,由MFC里的重载的new 给代替了我们平时所用的new,所以就出错了。
由此得出,写代码的时候我们应该学会规范的使用名字空间,比如在头文件里面不要使用名字空间的using语句,尽量局部的使用名字空间等.......
方法四(推荐):
我们修改一下位于 Visual C++ 安装目录下的 \Vc7\PlatformSDK\Include\GdiPlusBase.h文件, 在 GdiPlusBase 类中加入以下橙色代码部分, 完成后GdiPlusBase.h 文件完整内容如下 :
#ifndef_GDIPLUSBASE_H
#define_GDIPLUSBASE_H
class GdiplusBase
{
public:
void(operator delete)(void*in_pVoid)
{
DllExports::GdipFree(in_pVoid);
}
void* (operator new)(size_t in_size)
{
returnDllExports::GdipAlloc(in_size);
}
void (operator delete[])(void* in_pVoid)
{
DllExports::GdipFree(in_pVoid);
}
void * (operator new[])(size_t in_size)
{
return DllExports::GdipAlloc(in_size);
}
void * (operator new)(size_t nSize,LPCSTR lpszFileName, int nLine)
{
return DllExports::GdipAlloc(nSize);
}
voidoperator delete(void* p, LPCSTR lpszFileName, int nLine)
{
DllExports::GdipFree(p);
}
};
#endif
- error C2660: “Gdiplus::GdiplusBase::operator new”: 函数不接受 3 个参数(转)
- error C2660: “Gdiplus::GdiplusBase::operator new”: 函数不接受 3 个参数(转)
- error C2660: “Gdiplus::GdiplusBase::operator new”: 函数不接受 3 个参数
- error C2660: “Gdiplus::GdiplusBase::operator new”: 函数不接受 3 个参数
- error C2660: “Gdiplus::GdiplusBase::operator new”: 函数不接受 3 个参数
- "Gdiplus::GdiplusBase::operator new 函数不接受3 个参数"问题的处理
- "Gdiplus::GdiplusBase::operator new 函数不接受3 个参数"问题的处理
- Gdiplus::GdiplusBase::operator new 函数不接受3 个参数"问题的处理
- "Gdiplus::GdiplusBase::operator new 函数不接受3 个参数"问题的处理
- error C2660: 'Gdiplus::GdiplusBase::operator new'
- vtkcallbackcommand.h(46): error C2660: “vtkObjectBase::operator new”: 函数不接受 3 个参数
- 错误 C2660: Gdiplus::GdiplusBase::operator new: 函数不带三个参数
- error C2660: 'Gdiplus::GdiplusBase::operator new' : function does not take 3 parameters
- error C2660: “MessageBoxA” : 函数不接受 1 个参数
- 【error C2660: “GetDlgItem”: 函数不接受 1 个参数】
- error C2660: “MessageBoxA” : 函数不接受 1 个参数
- 错误1error C2660: 函数不接受 10 个参数
- operator new 函数不接受 3 个参数(错误及修正方法)
- Cube Simulation zoj3429 模拟
- 二维费用背包
- 2.1 Qemu用户态 Machine与cpu管理
- Oracle OLAP 与 OLTP 介绍
- HTML5基础20----Web Storage概述
- error C2660: “Gdiplus::GdiplusBase::operator new”: 函数不接受 3 个参数(转)
- INT_MAX,INT_MIN,isdigit函数
- matlab cosd,cos,acos,acosd
- MySQL架构方案
- 将tomcat添加为 linux service 服务
- 进程管理(3-3)
- 获取美版的google play store
- 字典树简介
- Xamrin开发安卓笔记(二)