error C2665: “operator new” : 5个重载中没有一个可以转换参数1(从“const char [71]”类型)

error C2665: “operator new” : 5个重载中没有一个可以转换参数1(从“const char [71]”类型)
这个错误是怎么回事啊,搜索了整个项目好像没有可疑的new操作阿。这个错误是在将两个工程合并成一个过程中产生的。合并前没有这样的错误。
MainFrm.cpp
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xmemory(34) : error C2665: “operator new” : 5 个重载中没有一个可以转换参数 1(从“const char [71]”类型)
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\new.h(100): 可能是“void *operator new(size_t,const std::nothrow_t &) throw()”
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\new.h(108): 或       “void *operator new(size_t,void *)”
        试图匹配参数列表“(const char [71], int)”时
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xmemory(137) : 参见对正在编译的函数模板实例化“_Ty *std::_Allocate<std::allocator<_Ty>::value_type>(size_t,_Ty *)”的引用
        with
        [
            _Ty=std::allocator<char>::value_type
        ]
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xmemory(136) : 编译类模板成员函数“std::allocator<_Ty>::pointer std::allocator<_Ty>::allocate(std::allocator<_Ty>::size_type)”时
        with
        [
            _Ty=char
        ]
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xstring(30) : 参见对正在编译的类模板实例化“std::allocator<_Ty>”的引用
        with
        [
            _Ty=char
        ]
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xstring(46) : 参见对正在编译的类模板实例化“std::_String_val<_Ty,_Alloc>”的引用
        with
        [
            _Ty=char,
            _Alloc=std::allocator<char>
        ]
        d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xstring(1569) : 参见对正在编译的类模板实例化“std::basic_string<_Elem,_Traits,_Ax>”的引用
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]


、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、


据说是因为STL与DEBUG NEW运算符的冲突(影响list、vector等)

解决方法1:注释掉以下代码:
#ifdef _DEBUG
#define new DEBUG_NEW
#endif

解决方法2:
将:代码中的#include <vector>移到stdafx.h的开头,也就是#program once的后面。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lcyw

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值