zoukankan      html  css  js  c++  java
  • PCH Warning: header stop cannot be in a macro or #if block.

    在编写头文件时,遇到这么一个warning:PCH Warning: header stop cannot be in a macro or #if block. An intellisense PCH file was not generated.

    查询后大概原因是这样:

    如果一个头文件在你的工程或解决方案中,没有被任何其他.c/cpp文件包含(include),那么就很有可能获得一个PCH warning。

    If the header is not included by any cpp file in your project/solution, you could potentially get a PCH warning. This is because our intellisense engine works with translation units instead of individual files. A translation unit is essentially a .c/cpp file and all the header files that were included. When a header file, say x.h, is opened, VS searches the include graph and find a suitable c/cpp file that includes x.h use that as the translation unit for the intellisense engine. However, if x.h is not found in the include graph (ie. not included by any .c/cpp file in the project), then the intellisense engine will use the header file itself as the translation unit (eg. treating that header file as a .c/cpp file). In that case, the intellisense engine won’t be able to generate the iPCH due to the reason described by the error message itself. As you already know, you can work around this by including the problematic headers in a .c/cpp file.

    解决:

    在该cpp文件的开头加上#pragma once

  • 相关阅读:
    The Country List
    hdoj1215--七夕节(数学)
    Poj 1654--Area(叉积)
    Poj2229--Sumsets(递推)
    数据预处理 center&scale&box-cox
    caret 分类回归树 用法
    ensemble 的2篇入门 文章
    数组 array 矩阵 list 数据框 dataframe
    R list frame, matrix
    R 如何 隐藏坐标轴
  • 原文地址:https://www.cnblogs.com/sea-stream/p/10205513.html
Copyright © 2011-2022 走看看