Gcc: undefined reference to 'std: cout'

Source: Internet
Author: User

GCC says: Undefined reference to 'std: cout' @ 10/17/2005
Computing life
The program written by the boss should be run in Linux and Windows. As a result, I first wrote it through vs.net and then compiled it under GCC. This error occurs on N screens.

I guarantee that my program is definitely a standard C ++ program. If GCC doesn't recognize it, I will be ft.

The GCC version is too old. Update to 3.4.4 and the result is the same.

Set
# Include <iostream>
Using namespace STD;
Change
# Include <iostream. h>
The results are the same.

Depressed, write a hello World Program and find that this error occurs when the iostream library is used.

Google found that N people had this error, that is, no one answered the question positively. Someone asked this question in a mailing list related to cygwin. The answer below is to let him send the versions of cygwin, GCC, and cygwin packages, dizzy. This issue has nothing to do with the version!

Finally, I found a very unpopular Forum. The answer in it was very simple: Compile the C ++ program and use g ++.

I was depressed on the spot. It was so easy to work with me for a long time! Try it by yourself
G ++ helloworld. cpp
Once successful. This kind of problem... Alas, I believe many c ++ programmers who have switched from windows to Linux should have met it. Why doesn't I write it in manual of GCC?

There was another problem when I first started using gcc a few days ago, that is, the old prompt "No newline at end of File". Later, I learned that the last line had to leave a blank line on the Internet for a while ......

Everything is hard at the beginning. It is even harder to learn to use Linux, such as the evil unhuman opensource software ......

 

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.