gpt4 book ai didi

c++ - MSVC 预编译 header : Which files need to #include "stdafx.h"?

转载 作者:搜寻专家 更新时间:2023-10-31 00:49:38 24 4
gpt4 key购买 nike

是否每个文件都需要 #include "stdafx.h"使用预编译头文件时?或者只有源文件需要包含它。

编辑:另外,我的预编译头文件 #includes很多 STL 头文件。但是,在我的标题中,我有时会返回 std::vector 的函数。或类似的东西,所以我需要 #include <vector>反正。这比包含 stdafx.h 更糟糕吗?我需要包括我的单元测试框架的定义。

最佳答案

每个源文件都需要在任何非注释行之前包含它。 header 不需要包含它,因为每个源文件都会在任何其他 header 之前包含它。

关于c++ - MSVC 预编译 header : Which files need to #include "stdafx.h"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1047152/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com