相关疑难解决方法(0)

C++中命名空间别名的范围是什么?

在函数定义中定义的C++名称空间别名是否具有块,函数,文件或其他范围(有效期)?

c++ scope namespaces

19
推荐指数
1
解决办法
4350
查看次数

"'命名空间'之前的预期不合格ID"错误

我有以下看似无害的代码:

#ifndef UI_H
#define UI_H

#include <string>

namespace ui
{
    //Displays the main menu, showing loaded vocabulary cards
    //
    //Returns upon completion of display
    void displayMainMenu();

    //...More code like the above, just comments followed by functions
}

#endif
Run Code Online (Sandbox Code Playgroud)

这给了我这个错误信息:

filepath/ui.h:6: error: expected unqualified-id before 'namespace'
Run Code Online (Sandbox Code Playgroud)

我在这做错了什么?

c++ debugging namespaces

8
推荐指数
1
解决办法
3万
查看次数

标签 统计

c++ ×2

namespaces ×2

debugging ×1

scope ×1