Jump to content
  • Advertisement
Sign in to follow this  
Kryodus

Can't get iostream to work using C++ Vis Studio .net 2003

This topic is 4836 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

I typcailly use two different file editors to edit my c++ files, vis studio and jen's file editor. For some reason I can't get vis studio to recognize commands like cout <<"blah"<<endl; I get the error error C2065: 'cout' : undeclared identifier I can get all other packages like stdio.h and stdlib.h to work perfectly on my vis studio. I load it #include <iostream> It works perfectly fine when using jen's file editor. Anyone know any possible reasons this happens?

Share this post


Link to post
Share on other sites
Advertisement
std::cout

remember, everything in the standard library is inside the std namespace so you have to qualify it with std:: or make a using declaration like using std::cout;

Share this post


Link to post
Share on other sites
"everything in the standard library is inside the std namespace "

I dont really know what the STD namespace is.. I dont fully undertand this sentence.


I also dont understand what it means to "qualify" something with std::

Could you perhaps refer me to somewhere that may touch upon this subject in more detail?
------------------------------------------------------------------------

EDIT: did some reading, and understand these sentences more, still kind of iffy on why I dont have to do that with something like printf...

[Edited by - Kryodus on May 21, 2005 3:48:36 PM]

Share this post


Link to post
Share on other sites
You guys are my heros, thanks problem solved.

And I read more into namespaces, got some more insight into this beautiful language.

Rating ++!!! :)

Thanks

Share this post


Link to post
Share on other sites
DON'T use <iostream.h>... It is an older version.

Just on top of your program write

#include <iostream>
using namespace std;

simple as that.

Share this post


Link to post
Share on other sites
Namespaces help prevent name clashes -creating more than one variables with the same name. Also you can group related names together to make it easier to understand what they are used for i.e...


namespace Harry {
int x;
int y;
std::string name;
}


To use a name in the Harry namespace you use the scope operator ::

Harry::name = "Harry";

I hope that helped.

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!