Jump to content
  • Advertisement

Archived

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

gambit

problems with namespace std

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

//betrayer of code ...ur tutorial for total noobs //page1 gives us an example #include <iostream.h> #include <stdlib.h> using namespace std; int main() { cout<< "my first C++ program..etc..\n"; system ("pause"); return 0; } /* this doesnt compile...generates...... --------------------Configuration: helloworld2 - Win32 Debug-------------------- Compiling... horray.cpp F:\Softwware Programing 28-1-03\C++\1 tests\betrayer of code\horray.cpp(7) : error C2871: ''std'' : does not exist or is not a namespace Error executing cl.exe. horray.obj - 1 error(s), 0 warning(s) */ /*maybe some1 could tell wot namespace is all about I heard itz got something to do with removing the need of using std : : cout<< but when I tried using std : : cout<< (with out namespace) it too generated errors .... any ideaz ??? */

Share this post


Link to post
Share on other sites
Advertisement
With most compilers the standard is to include c++ header files without the extension *.h (the extension .h is only used to include C header files, for instance the C standard library stdlib.h)

So simply replace #include <iostream.h> with #include <iostream>

Cheers, and have fun.

[edited by - Kronos on February 3, 2003 1:16:26 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Kronos
With most compilers the standard is to include c++ header files without the extension *.h (the extension .h is only used to include C header files, for instance the C standard library stdlib.h)



C++ headers for the C library also lose the ''.h'' and gain a ''c'' prefix. Thus <stdlib.h> becomes <cstdlib>.


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!