我在子目录libA中的几个项目中使用了单元a.cpp。一些项目使用预编译头文件,而另一些项目使用-not。在这种情况下,使用预编译头的项目必须具有以下行:
#include <stdafx.h>不使用PCH的项目必须有行:
#include "..\stdafx.h"明智的诗句是不起作用的。
为什么project在使用PCH和不使用PCH时会看到不同的stdafx.h文件?
UPD。
在使用预编译头的项目中用#include "..\stdafx.h"替换行#include <stdafx.h>时,出现错误
Error 19 error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?两个项目中的目录结构是相同的。
发布于 2015-01-05 23:23:58
在<stdafx.h>和"stdafx.h"之间没有(或者不应该有任何)区别。唯一显著的区别是一个项目“看到”当前文件夹中的文件,而另一个项目在父文件夹中看到它。这种差异由编译器选项Additional Include Directories控制。一个项目中有libA,另一个项目中没有。
https://stackoverflow.com/questions/27782286
复制相似问题