错误35错误C2661:&x27;新操作员';:没有重载函数接受2个参数 我不是一个精通C++程序员,我在一个Visual Studio解决方案中得到了一个真正的大项目(实际上有24个)。
我几乎在整个项目中都遇到了这个错误,我不知道如何解决它 当我双击错误时,它会将我带到以下位置:错误35错误C2661:&x27;新操作员';:没有重载函数接受2个参数 我不是一个精通C++程序员,我在一个Visual Studio解决方案中得到了一个真正的大项目(实际上有24个)。,c++,operator-overloading,new-operator,C++,Operator Overloading,New Operator,我几乎在整个项目中都遇到了这个错误,我不知道如何解决它 当我双击错误时,它会将我带到以下位置: for( int i = 0; i < nNewSize; i++ ) #pragma push_macro("new") #undef new ::new((void*)(m_pData+i))TYPE; #pragma pop_macro("new") 但没有效果 请帮帮我 您显示的一小段代码非常糟糕:如果new被定义为 在宏中,您有未定义的行为,至少在包含任何 标准标题
for( int i = 0; i < nNewSize; i++ )
#pragma push_macro("new")
#undef new
::new((void*)(m_pData+i))TYPE;
#pragma pop_macro("new")
但没有效果
请帮帮我 您显示的一小段代码非常糟糕:如果
new
被定义为
在宏中,您有未定义的行为,至少在包含任何
标准标题
尽管如此,我认为编译器所抱怨的那一行还是有些问题
称为新的。要使用它,必须包含标题
。(如果已将new
定义为宏,则此操作将不起作用。
找到这个定义出现的地方,然后把它去掉。)我的建议是马上逃跑。这个项目只会带来痛苦。是的,我知道。这是我第二周在做这件事,我开始感到非常沮丧。我已经解决了很多错误,现在我就在这里。我想知道什么样的组织会给24个项目提供一个解决方案,而不是一个有经验的C++程序员。这是很多代码,你不能保持C++而不知道C++。谢谢!成功了。我以前试过发表评论,但从未包括在内
c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\afxtempl.h(403): error C2661: 'operator new' : no overloaded function takes 2 arguments
19> c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\afxtempl.h(368) : while compiling class template member function 'void CArray<TYPE,ARG_TYPE>::SetSize(INT_PTR,INT_PTR)'
19> with
19> [
19> TYPE=D2D1_GRADIENT_STOP,
19> ARG_TYPE=D2D1_GRADIENT_STOP
19> ]
19> c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\afxtempl.h(643) : see reference to function template instantiation 'void CArray<TYPE,ARG_TYPE>::SetSize(INT_PTR,INT_PTR)' being compiled
19> with
19> [
19> TYPE=D2D1_GRADIENT_STOP,
19> ARG_TYPE=D2D1_GRADIENT_STOP
19> ]
19> c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\afxtempl.h(355) : while compiling class template member function 'CArray<TYPE,ARG_TYPE>::~CArray(void)'
19> with
19> [
19> TYPE=D2D1_GRADIENT_STOP,
19> ARG_TYPE=D2D1_GRADIENT_STOP
19> ]
19> c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\afxrendertarget.h(1028) : see reference to class template instantiation 'CArray<TYPE,ARG_TYPE>' being compiled
19> with
19> [
19> TYPE=D2D1_GRADIENT_STOP,
19> ARG_TYPE=D2D1_GRADIENT_STOP
19> ]
CArray<D2D1_GRADIENT_STOP, D2D1_GRADIENT_STOP> m_arGradientStops;
#ifdef _DEBUG
#define new DEBUG_NEW
#endif