How to fix error: unknown type name ‘namespace’

前端 未结 3 1356
暖寄归人
暖寄归人 2021-01-04 14:05
#ifndef UNO_ACTION_ 
#define UNO_ACTION_
namespace Uno
{
namespace Game
{
    class Game;
}
} // namespace

namespace Uno
{
namespace Action
{
using ::Uno::Game::Gam         


        
相关标签:
3条回答
  • 2021-01-04 14:33

    I had a similar issue and found this question but the solutions don't match mine completely, so I'm adding mine here.

    In my case, I was including a header file in .cpp files and .c files. The solution was to split off the namespace part of the header since that was obviously only needed in the .cpp files.

    0 讨论(0)
  • 2021-01-04 14:36

    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).

    0 讨论(0)
  • 2021-01-04 14:45

    Had this issue with YCM and clang. Turns out, the missing flag was "-x", "c++".

    From the official clang documentation:

    -x <language> : Treat subsequent input files as having type language.

    0 讨论(0)
提交回复
热议问题