using namespace std; NOT FOUND

Hi,

i am using MS VS 2003.NET.

When I want to import the namespace std by "using namespace std;" I get the error C2061 "namespace not found".

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <mil.h>
#include <string.h>
using namespace std;


I don't know what to do!
All your header files are "C" files that you shouldn't use. You need to figure out which parts of the standard library you want to use, and include the correct header files.

The closest to what you have in your post would be:

1
2
3
4
5
6
#include <cstdio> // instead of <stdio.h>
#include <cstdlib> // instead of <stdlib.h>
// #include <conio.h> -- do not use
#include <mil.h> // don't know what this is
#include <cstring> // instead of <string.h>
using namespace std;


Note 1: If you just want to print some output, you should learn how to use <iostream> instead of <cstdio>.
Note 2: If you are including <string.h> because you want the std::string class, you should change it to <string>, not <cstring>.
Thx for your answer. My file was still saved as a *.C File. When I changed it into *.CPP it woked!
Last edited on
Topic archived. No new replies allowed.