如何修复'PCH Warning: header stop not at file scope'
How to fix 'PCH Warning: header stop not at file scope'
我已经将我的程序和头文件设置为我认为正确的方法,但我不断收到标题中提到的错误。
我尝试搜索此问题的修复程序,其中大多数只是在头文件中的类定义后添加";"。我已经尝试了我能找到的大多数修复程序,结果相同。
以下是标记错误的主程序:
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include "computeGross.h"
#include "computeInsurance.h"
#include "Employee.h" /*<-----------------This is where the error flags*/
using namespace std;
int main()
{ }
这是错误标记的头文件:
#ifndef EMPLOYEE_H
#define EMPLOYEE_H
#include <string>
using namespace std;
struct Employee
{
string name;
double rate;
double hours;
double insurance;
double social;
double stateTax;
double fedTax;
double netPay;
double grossPay;
};
#endif
仅供参考,当我在另一个 .h 文件中留下一个 ; 关闭另一个 .h 文件中的声明。由于该声明从未完成,因此当在下一个 .h 文件中遇到 #define 时,它会抛出此错误。
尝试更改头文件的顺序。尝试创建一个新的 cpp 文件,并一次包含一个标头。看看哪一个坏了。
减少错误的可能原因,直到找到它。
相关文章:
- OpenMP卸载说'fatal error: could not find accel/nvptx-none/mkoffload'
- 如何处理来自核心指南检查器的关于gsl::at的静态分析警告
- 使用JsonCpp将数据返回到带有pybind11的python会在python调用中产生Symbol not foun
- OpenCV Android C++ imwrite not found
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 使用单词"not"作为C ++类的名称会导致VS2019错误
- 错误"Could not find Boost"(缺少:上下文标头)
- "CID"在AT+HTTPPARA= "CID" ,1中是什么意思
- 如何修复"error: ‘_1’ was not declared in this scope"?
- 套接字连接"Operation not permitted"错误,甚至使用升压/平发器根.cpp
- Is !NaN not a NaN?
- 为什么我会" void value not ignored as it ought to be"?
- 解决"ld: library not found for -ltensorflow_framework.2.3.0"
- 加载与引用 .NET DLL 位于同一文件夹中的引用的 .NET DLL 时"Not found"异常
- Directx 11 - CompileFromFile() is not compiling
- 方法错误"not all control paths return a value"和方法不返回值
- Centos7 g++ "to_string is not in a member of std"
- 如何修复'PCH Warning: header stop not at file scope'
- "local variables at the outermost scope of the function may not use the same name as any parameter"是
- 断点未命中 - "the module did not load at the default load address"