一般出现:warning C4627: '#include "../stdafx.h"': skipped when looking for precompiled header

这个错误时,只需在源文件开头加上 #include "stdafx.h"即可。


但有时候,源文件是放在与stdafx.h不同目录下的,直接按以上做法是不可行的。需要将stdafx.h的路径包含进项目工程里,在按上面的做法即可。

将stdafx.h所在路径添加进项目工程的方法如下:

 add "$(ProjectDir)" (or wherever the stdafx.h is) to the list of directories under:

 Project->Properties->Configuration Propertes->C/C++->General->Additional Include Directories.