Why the error message?

This is a discussion on Why the error message? within the C++ Programming forums, part of the General Programming Boards category; Iíve recently started using the bloodshed dev IDE. I got an error message in one program and I couldnít work ...

  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,048
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21