[Solved] PCH Warning: header stop not at file scope

Produces warnings when importing custom header files:PCH Warning: header stop not at file scope

The editor is VSCode, the compiler is g++11IntelliSense, and the code checker (that is, the one that reports the error) is IntelliSense.

The specific reason is: the syntax of c++17 is used in the code, which does not match the configuration of IntelliSense, and IntelliSense cannot recognize the syntax of the header file during precompilation.

According to the error message, find the relevant configuration of IntelliSense, because there are multiple c++ compilers on the computer, but there is no corresponding configuration when using IntelliSense. As can be seen the compiler used is clangnot actually used g++11.


Modify the compiler configuration and add parameters -std=c++17to make the precompilation of IntelliSense work normally, indicating that the syntax of c++17 is used.


Or do not add parameters -std=c++17, there is a configuration below that can modify the c++ standard used, and it can also work normally if it is changed to c++17.


Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *