Archived

This topic is now archived and is closed to further replies.

Stamf

Ignore, sorry

Recommended Posts

You are running into a common problem which has to do with the history of C/C++.

Here is the OLD C++ way to do things (before the standard)


      
// c header file

#include <stdlib.h>

// c++ header file

#include <iostream.h>

// non-c++ headers

#include <windows.h>

int main(void)
{
cout << "hello world" << endl; // no namespace used

}



here is the new (standard) c++ way to do things



        
// c header file, no .h and add c prefix

#include <cstdlib>

// C++ standard headers have no .h

#include <iostream>

// non-c++ headers, no change

#include <windows.h>

int main(void)
{
std::cout << "hello world" << std::endl;
}


so in C++ all C / C++ standard header files do not have a .h suffix anymore, and their contents are now in namespace std. Of course you can use the using clause

using namespace std;

I just figured my example was better showing what was in the namespace.

[edited by - Xai on January 19, 2003 11:18:12 PM]

[edited by - Xai on January 19, 2003 11:19:02 PM]

Share this post


Link to post
Share on other sites
can i just say ... DON''T DO THAT ...

NEVER EVER EVER go delete the original question from a post. First of all, because someone else may be having the same problem ... but how are they gonna find the answer?

If you had left the question alone, and ADDED a new response saying you got it ... then others who did a search on "namespace std" would have found your problem and the solution ... now they probably won''t

Share this post


Link to post
Share on other sites