可以将力包括在视觉C 中与预编译的标头一起使用
Can force include be used with pre-compiled headers in Visual C++?
如果为单个CPP文件设置了/Yu
(即整个项目)是否可以设置/FI
来指定要包含的标头文件,或者必须随身携带标题文件。例如#include "stdafx.h"
如果将/Yu"stdafx.h"
传递给CL?
所有以下结果基本相同的错误...
用C:pathtostdafx.h
的标头和test.cpp
喜欢...
// Not including `stdafx.h`
void foo() {}
和其中任何一个要编译...
CL.exe /c /Yu"stdafx.h" /FI"C:pathtostdafx.h" test.cpp
CL.exe /c /Yu /FI"C:pathtostdafx.h" test.cpp
CL.exe /c /Yustdafx.h /FIC:pathtostdafx.h test.cpp
CL.exe /c /Yu /FIC:pathtostdafx.h test.cpp
fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
在我看来,应该可以使用/FI
指定预编译标题。
这个答案似乎表明它甚至是首选方法https://stackoverflow.com/a/11052390/6225135
问题是stdafx.h
不是C:pathtostdafx.h
。VC 进行字符串比较。您需要将C:pathto
添加到Include路径,因此您可以仅使用/FI"stdafx.h"
经过一些实验,我设法使其正常工作。事实证明,我要做的就是提供与/Yu
/FI"stdafx.h"
相关文章:
- 要与"if constexpr"一起使用的编译时消息(在预处理器之后)
- 使用个人C++库编译代码时,与头文件一起使用时会中断
- 将 std::variant 与 gmock 1.8 对象一起使用时编译错误
- 为什么引用不能与编译时函数一起使用?
- 如何将编译的 wxwidgets 与 cmake 一起使用
- 与类一起使用时 std::reference_wrapper "has no member named" 编译错误
- 与C 一起编译和链接卷曲简易接口
- C++:当与 std::cout 一起使用时,constexpr 函数在编译时不会计算
- 将PCH,PDB和Zi组合在一起会导致VS2017的C2859编译错误令人费解
- 可以将力包括在视觉C 中与预编译的标头一起使用
- 与教堂的"compileline"一起编译C++
- 如何与CMAKE一起使用VS 2017编译的Boost Filesystem库
- 在代码块中一起编译两个项目
- 在Java(JNI)中与Mingw C 一起编译64位静态LIB
- 如何在编译时检查两种类型是否相同(奖励点是否可与Boost strong typedef一起使用)
- 使用QMake将Ubuntu中的QT和OPENCV一起编译
- 是否可以将addr2line与使用发布优化参数编译的应用程序一起使用
- 无法将-std标志与g++一起使用进行编译
- OpenGL/ES 2.0及更高版本:如何将多个着色器文件编译在一起
- 与Cygwin一起编译一个C++项目