How to fix error: unknown type name ‘namespace’

c++

Solution

It sounds like you're trying to compile your C++ code with a C compiler. Try using `g++` instead of `gcc` and giving your file a C++ extension such as `.cpp` (rather than `.c`).

Problem

``` #ifndef UNO_ACTION_ #define UNO_ACTION_ namespace Uno { namespace Game { class Game; } } // namespace namespace Uno { namespace Action { using ::Uno::Game::Game; class Action { public: virtual bool isDisposeable() = 0; virtual void takeAction(Game* game) = 0; virtual ~Action() {} }; } } #endif ``` I compile these code on ubuntu 12.04 and it returns to set of error: ``` action.h:4:1: error: unknown type name ‘namespace’ action.h:4:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token action.h:8:1: error: unknown type name ‘namespace’ action.h:8:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token ``` How do I solve these errors?

Original source