How to fix compiler error: "Namespace name expected" ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Godlove Mathew
    New Member
    • Dec 2010
    • 1

    How to fix compiler error: "Namespace name expected" ?

    Hi, I installed a Borland C++ in my laptop a 32-bit operating system with windows vista.

    I wrote i very simple program to display "Hello world" but it gives an error

    // my first program in C++

    #include <iostream>
    using namespace std;

    int main ()
    {
    cout << "Hello World!";
    return 0;
    }

    the error is [noname00.ccp(3, 16): Namespace name expected, please help me

    Mathew
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    You code looks completely fine to me and compiles without problem using MinGW on Windows XP.

    I have to say my suspicions as soon as you mentioned "Borland C++" since they are not really a compiler writer any more so I am kind of assuming that you are using an out of date compiler.

    I would suggest that you try I different more up to date compiler such as MinGW or Microsoft Visual C++ Express Edition (both of which are free).

    Comment

    Working...