在编写头文件时,遇到这么一个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

PCH Warning: header stop cannot be in a macro or #if block.的更多相关文章

  1. C1853 编译器错误:fatal error C1853: 'pjtname.pch' precompiled header file is from a previous

    转载:https://www.cnblogs.com/emanlee/archive/2010/10/16/1852998.html 用VC++ 2008 编写C语言程序,编译出现错误: 预编译头文件 ...

  2. xcode6以后, 使用.pch

    http://blog.csdn.net/lihuiqwertyuiop/article/details/39268101 总结: . 创建.pch文件 . Apple LLVM 6.1 - Lang ...

  3. xcode6中如何添加pch文件

    在Xcode6之前,新建一个工程的时候,系统会帮我们自动新建一个以工程名为名字的pch (precompile header)文件,在开发过程中,可以将那些整个工程都广泛使用的头文件包含在该文件下,编 ...

  4. 在工程中添加pch文件

    在Xcode6之前,新建一个工程的时候,系统会帮我们自动新建一个以工程名为名字的pch (precompile header)文件,在开发过程中,可以将那些整个工程都广泛使用的头文件包含在该文件下,编 ...

  5. PrefixHeader.pch' file not found 以及 Xcode 中如何添加pch文件

    在开发的过程中,有时候接触到旧项目,会报: 'PrefixHeader.pch' file not found 的错误! 在Xcode6之前,新建一个工程的时候,系统会帮我们自动新建一个以工程名为名字 ...

  6. iOS布局---pch头文件设置和字号适配

    由于4s,5s,6,6p,界面尺寸差别过大,如果在界面上,只是用同一个字号,在4s和5s上就会略显偏大,而在6p上就会显小.并且ios9系统原生字体相较于ios8和之前原生字体略粗,在字号上也错了一号 ...

  7. PE Header and Export Table for Delphi

    Malware Analysis Tutorial 8: PE Header and Export Table 2. Background Information of PE HeaderAny bi ...

  8. VC 宏与预处理使用方法总结

    目录(?) C/C++ 预定义宏^ C/C++ 预定义宏用途:诊断与调试输出^ CRT 和 C 标准库中的宏^ NULL 空指针^ limits.h 整数类型常量^ float.h 浮点类型常量^ m ...

  9. ARC中用代码检测一个对象有没有释放掉

    ARC中用代码检测一个对象有没有释放掉 你试过在ARC中用代码检测对象有没有释放掉这种事情呢?即使你想过肯定也不知道怎么去实现,因为,这里会用到一个你基本上没怎么接触过的类:NSHashTable. ...

随机推荐

  1. (转)How to Use Elasticsearch, Logstash, and Kibana to Manage MySQL Logs

    A comprehensive log management and analysis strategy is vital, enabling organizations to understand ...

  2. FDR错误发现率-P值校正学习[转载]

    转自:https://baike.baidu.com/item/FDR/16312044?fr=aladdin  https://blog.csdn.net/taojiea1014/article/d ...

  3. Java序列化总结

    什么是序列化? 序列化是将对象的状态信息转化为可以存储或传输的形式的过程.在序列化期间,对象将其当前状态写入到临时或持久性存储区.以后可以通过存储区中读取或反序列化对象的状态重新创建对象. 为什么要序 ...

  4. nodejs 将网上的图片下载到本地文件

    var request = require('request'); var fs = require('fs'); var img_src = 'https://www.baidu.com/img/b ...

  5. MongoDB 工具助手类(.NET)

    在开发过程中,需要用到MongoDB,本身MongoDB自己对类的封装就特别好了.为了更加符合我们平时的开发使用,我现在进行了一个简单的封装操作. 连接数据库类:MongoDBContext usin ...

  6. JS中“==”和“===”的原理和区别

    1.为什么讨论这个问题? - 有个说法,尽量不用==,而使用===,是这样吗? 2.分析问题,原理是什么? 下面说说ECMAScript 5 language specification里的说明: 1 ...

  7. cheng gong de daima

    /** * Copyright (c) 2012-2016 ebizwindow, Inc. All rights reserved. * * Permission is hereby granted ...

  8. OAuth 白话简明教程 3.客户端模式(Client Credentials)

    转自:http://www.cftea.com/c/2016/11/6704.asp OAuth 白话简明教程 1.简述 OAuth 白话简明教程 2.授权码模式(Authorization Code ...

  9. 十图详解tensorflow数据读取机制

    在学习tensorflow的过程中,有很多小伙伴反映读取数据这一块很难理解.确实这一块官方的教程比较简略,网上也找不到什么合适的学习材料.今天这篇文章就以图片的形式,用最简单的语言,为大家详细解释一下 ...

  10. Python 运算符与基本数据类型

    一.运算符 1.算数运算: 2.比较运算: 3.赋值运算: 4.逻辑运算: 5.成员运算: 二.基本数据类型 1.空(None) 表示该值是一个空对象,空值是Python里一个特殊的值,用None表示 ...