Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Namespace std

Status
Not open for further replies.

nahojnedreeb

Programmer
Mar 15, 2005
2
BE
Well i am using C++.NET since a week. I started to learn it and short after starting to learn I saw that I need to use namespace std

But when I want to use it I get an error...

What I did:

using namespace std;

what the error is:

c:\Documents and Settings\Johan\Mijn documenten\Visual Studio Projects\testenblablabla\testenblablabla.cpp(5): error C2871: 'std' : a namespace with this name does not exist

can someone of you help me please?
 
Have you any header with namespace std (#include <xxxx>?). If not, no namespace std in your program, it's true...
 
if you didn't do that already, try the line

Code:
 #include <iostream>

before

Code:
 using namespace std;

could help...
 
doesn't work with the line #include <iostream> before the using namespace...

Maybe another solution? :s
 
Post the code that is giving you the error, or at least the first part of the file that gets the error.

What kind of VC++.NET project/solution did you create?

Does this work:
Code:
#include <iostream>

using namespace std;

int main()
{
  cout << "Hello World!" << endl;
}
 
i don't have much experience with .net...
but if the above code does not work, replace the line:

cout << "Hello World!" << endl;

with std::cout<<"Hello World" << std::endl;

and see if that works..
 
any luck with this?

make sure you are creating the correct type of project.. as i said, i don't have much experience with .net.. but when i did use it i got a few errors because of the way i created teh project..


shows you how to create a project. upto step 2 is relevant... if you have used vc++ before, you will already know the rest :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top