IntelliSense: PCH warning: header stop cannot be in a macro or #if block. An intellisense PCH file

来源:互联网 发布:mac book可以安装vs么 编辑:程序博客网 时间:2024/06/05 02:06

今天在vs2010写了点代码,居然报了“IntelliSense: PCH warning: header stop cannot be in a macro or #if block.  An intellisense PCH file was not generated.”。

代码如下:

[cpp] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. #ifndef _COLORRECOGNITION_H_  
  2. #define _COLORRECOGNITION_H_  
  3.   
  4. #include <string>  
  5. #include <vector>  
  6.   
  7. int loadConfig();  
  8.   
  9. #endif  // _COLORRECOGNITION_H_  

错误:

[plain] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. IntelliSense: PCH warning: header stop cannot be in a macro or #if block.  An intellisense PCH file was not generated.  

修改办法,在代码顶部加上下面一句代码就ok了

[cpp] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. #pragma once  

修改后的代码

[cpp] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. #pragma once  
  2. #ifndef _COLORRECOGNITION_H_  
  3. #define _COLORRECOGNITION_H_  
  4.   
  5. #include <string>  
  6. #include <vector>  
  7.   
  8. int loadConfig();  
  9.   
  10. #endif  // _COLORRECOGNITION_H_  
1 0