Can't get iostream to work using C++ Vis Studio .net 2003
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?
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;
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;
"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]
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]
You guys are my heros, thanks problem solved.
And I read more into namespaces, got some more insight into this beautiful language.
Rating ++!!! :)
Thanks
And I read more into namespaces, got some more insight into this beautiful language.
Rating ++!!! :)
Thanks
similar thing has happend to me before intead of <iostream>
change to <iostream.h>
dosnt allways work
change to <iostream.h>
dosnt allways work
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.
Just on top of your program write
#include <iostream>
using namespace std;
simple as that.
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...
To use a name in the Harry namespace you use the scope operator ::
Harry::name = "Harry";
I hope that helped.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement