Sign in to follow this  
illadel4life

Another Stupid error, Can anybody help me THIS time

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 this post


Link to post
Share on other sites
Hes using std:: so why does he need using namespace std;

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

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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>.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this