Public Group

# Another Stupid error, Can anybody help me THIS time

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

## Recommended Posts

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

##### Share on other sites
using namespace std;

Put that under all your #includes.

##### Share on other sites
Hes using std:: so why does he need using namespace std;

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

##### Share on other sites
yeah i think asheh is right, you've probably left out one of the necessary includes to get the stream working.

##### Share on other sites
whoopsy. sorry, im a bit tired. asheh is probably right.

##### Share on other sites
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?

##### Share on other sites
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...

##### Share on other sites
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>.

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633742
• Total Posts
3013634
×