Jump to content
  • Advertisement
Sign in to follow this  
adam_o

iostream header

This topic is 4240 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, In my code, I use #include<iostream.h> so that I am able to call a "cout" command. My Xcode compiler (see below for specs) says that this is an "deprecated or antiquated" header. It then suggests using <iostream> instead of <iostream.h>. When I call that header, it gives me an error saying that "cout" was not declared. What gives?

Share this post


Link to post
Share on other sites
Advertisement
Use <iostream>.

To find cout, you need to let the compiler know that it'll be part of the 'std' namespace.

Either explicitly do it with: std::cout << "foo!" << std::endl;
Set std as the default namespace for the whole file (insert "using namespace std" at the top of your file, after includes)
Set std as the default namespace only for those symbols (at the top of the file, include "using std::count; using std::endl")

Share this post


Link to post
Share on other sites
Quote:
Original post by raz0r
cout lives in the std namespace.

Oh. Forgot about that... well problem solved thank you!

EDIT: Thank you both. I didn't see richards post when I posted.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!