Summary of common errors in C + +

Source: Internet
Author: User

1. error C2871: ' STD ': does not exist or was not a namespace

The original C + + has two different versions of the header file. The concept of introducing namespaces was previously compiled with # include <IOSTREAM.H>, while the concept of the namespace was introduced after the first name of the STD namespaces became <iostream>. <iostream.h> is the older C + + header file version, and namespace was added to the C + + standard in 98, so there is no Std namespace in <iostream.h>, when using < Iostream.h>, it is equivalent to calling library functions in C, using the global namespace, which is the earlier C + + implementation. Header file <iostream> does not define a global namespace and must use namespace Std to use cout correctly.
vc6.0 supports this two version. But it's all in <iostream>.
So just change the above statement to:
#include <iostream>
using namespace Std;
or #include <iostream.h>.

Summary of common errors in C + +

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.