Thread: Namespace

  1. #1
    Wannabe Geek
    Join Date
    Aug 2004

    Question Namespace

    I am using Borland C++ 5.02 and my operating system is Windows 2000.
    Im having trouble compiling the following code:-
    #include <iostream> 
    using namespace std;
    int main()
           cout << "Hello World";
           return 0;
    It however compiles in gcc.
    What is wrong with the code displayed above? Why does it not compile in Borland C++ 5.02?
    Thanx in Advance.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Could be that Borland C++ 5.02 is outdated and does not implement namespaces (correctly).
    Just search the Web and you'll probably get a clearer answer.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > Why does it not compile in Borland C++ 5.02?
    Why didn't you post the error message you got?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. extern namespace?
    By Brafil in forum C++ Programming
    Replies: 2
    Last Post: 01-10-2009, 08:06 AM
  2. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 03:11 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. data validation & namespace
    By tiange in forum C++ Programming
    Replies: 4
    Last Post: 07-05-2005, 02:45 AM