Thread: Why the error message?

  1. #1
    lucy
    Join Date
    Nov 2005
    Location
    england
    Posts
    2

    Why the error message?

    I’ve recently started using the bloodshed dev IDE. I got an error message in one program and I couldn’t work out why, but I’m a relative beginner so I expected that. However I’ve tried to compile some code from a CD and I get a similar error message

    expected unqualified-id before "namespace"
    expected `,' or `;' before "namespace"

    which points to one of the preprogrammed files. (\include\c++\3.4.2\bits\functexcept.h)

    A similar error message has appeared but with “namespace” replaced by something else. Does anyone know why this happens? I’ve stared at it for far too long!

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    what include files are you using? The one with, or without the .h extension? should be something like this
    Code:
    #include <string>
    #include <vector>
    
    ...
    using namespace std; <<< this does not work with include that have .h extension 

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Are you compiling a C++ program as a C one (ie, it has a .c extension)?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed