Include vector compilation error VC + +

Source: Internet
Author: User

Error C2665: "Operator new": 5 overloads without one can convert parameter 1 (from "const char [71]" type)
What's wrong with this, searching the whole project as if there were no suspicious new operations. This error is generated by merging the two projects into one process. There are no such errors before merging.
MainFrm.cpp
D:\Program Files\Microsoft Visual Studio. NET 2003\vc7\include\xmemory: Error C2665: "operator new": None of the 5 overloads can be converted to a parameter Number 1 (from "const char [71]" type)
D:\Program Files\Microsoft Visual Studio. NET 2003\vc7\include\new.h (100): May be "void *operator new (size_t,const std:: Nothrow_t &) throw () "
D:\Program Files\Microsoft Visual Studio. NET 2003\vc7\include\new.h (108): or "void *operator new (size_t,void *)"
When trying to match the parameter list "(const char [+], int)"
D:\Program Files\Microsoft Visual Studio. NET 2003\vc7\include\xmemory (137): See Instantiating a function template being compiled _ty *std::_allocate< Std::allocator<_ty>::value_type> (Size_t,_ty *) "reference
With
[
_ty=std::allocator<char>::value_type
]
D:\Program Files\Microsoft Visual Studio. NET 2003\vc7\include\xmemory (136): Compile class template member functions "STD::ALLOCATOR&LT;_TY&GT;:: Pointer std::allocator<_ty>::allocate (std::allocator<_ty>::size_type) "when
With
[
_ty=char
]
D:\Program Files\Microsoft Visual Studio. NET 2003\vc7\include\xstring (30): See Instantiating a class template being compiled std::allocator<_ty> "References to
With
[
_ty=char
]
D:\Program Files\Microsoft Visual Studio. NET 2003\vc7\include\xstring (46): See Instantiating a class template being compiled Std::_string_val<_ty,_ Alloc> "Reference
With
[
_ty=char,
_alloc=std::allocator<char>
]
D:\Program Files\Microsoft Visual Studio. NET 2003\vc7\include\xstring (1569): See Instantiating a class template being compiled Std::basic_string<_ Elem,_traits,_ax> "Reference
With
[
_elem=char,
_traits=std::char_traits<char>,
_ax=std::allocator<char>
]

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

It is said that the STL is in conflict with the debug new operator (affects list, vector, etc.)

Workaround 1: Comment out the following code:
#ifdef _DEBUG
#endif

solution 2:
# # # <vector> in code is moved to the beginning of stdafx.h, which is the back of #program once.

http://blog.csdn.net/machh/article/details/43450725

Include vector compilation error VC + +

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.