Another Stupid error, Can anybody help me THIS time

Started by
6 comments, last by evolutional 19 years, 8 months ago
Using the STD namespace I get an interesting error. I am using a peice of code that has std::istream thats being passed into a function, but it gives me a compiler error! The error basically states that the STD namespace is undefine. BUT within the same file wether it be the H file with the definition of the function or the Source file with the actual code(Both files give me this error) when I type STD:: and leave it blank, good ol VS.NET gives me the drop down menu of members of STD namespace. So that makes it a strange Error for me because I thought VS only gives the drop down menu when the class/namespace/definitions were defined before hand, and if so why does it tell me when I compile, that the STD namespace is not define. How would sombody go about defining the STD namespace, what Header file do I include? Thanks in Advance
Advertisement
using namespace std;


Put that under all your #includes.
Hes using std:: so why does he need using namespace std;

Have you included <iostream> and <fstream> etc?

yeah i think asheh is right, you've probably left out one of the necessary includes to get the stream working.
whoopsy. sorry, im a bit tired. asheh is probably right.
No I didn't so I will try to include those files. BUT I will mention that true this code isn't mine and before I implmented it into my code I ran and compiled thier entire project without using those Includes. AND I want to mention that when i do STD::_ it gives me the drop down menu without those includes.

Would the menu still be created even if I didn't have those includes?
The dropdown menu is part of the IDE not the API, So even if you havent included it, and there are still errors in your code, its likley that the ide just gives you the dropdown menu just to help you out...
As Asheh said, the IDE will cache an autocompletion database for most of the standard APIs and libraries, so because it appears in the dropdown menu, it doesn't necessarily mean you included the correct files.

Here's a link to the std::iostream reference which shows you which files you'll need to include in order to use a given stream. In your case, you need #include <istream>.

This topic is closed to new replies.

Advertisement