c++ - 编译器错误 : 'expected unqualified-id before "using '''

标签 c++ compiler-errors

这是我的代码:

    //test file
    #include <iostream>
    #include "stat.h"
    #include "frequency.h"

    using namespace std;

    int main(){
      cout << "helo"<< endl;
      return 0;
    }

当我尝试编译时,我得到:

    test.cc:7: error: expected unqualified-id before "using"
    test.cc:7: error: expected `,' or `;' before "using"

知道这里发生了什么吗?

最佳答案

你可能错过了;在头文件的末尾。

它应该是这样的:

 class frequency {
      ...
 };

关于c++ - 编译器错误 : 'expected unqualified-id before "using ''' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9696352/

相关文章:

c++ - 在没有 friend 的情况下在 C++ 中测试私有(private)类成员

C++ 文件处理:ios::app 和 ios::ate 之间的区别?

android - 类型不匹配 : inferred type is String? 但需要字符串 kotlin

c++ - 无效的显式参数

gcc - 如何将-std = c99传递给g++?

sql-server - 从以下脚本获取错误

c++ - 当初始化列表可用时,为什么现在使用可变参数?

c++ - 使用 OpenCV 查找图像中两点之间的角度

java - 为什么当参数和参数匹配时会发生 javac 错误 "(x) cannot be applied to (y)"? (内部类调用外部类方法)

c++ - 在 C++ 中免费分析?