Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果一个特定的头文件已经包含在 stdafx.h - 我是否需要(必须/应该)将它明确地包含在一个 .cpp 文件中(它已经包含了 stdafx.h)?
当为您创建 stdafx 时,它通常是一个预编译的头文件。作为预编译头文件,有必要将其添加到任何标记为使用预编译头文件的 .cpp(通常添加到项目中的任何 cpp,stdafx.cpp 除外)
您不需要包含已包含在 stdafx.h 中的头文件,再次包含它可能会给编译器带来额外的工作量。