我试图在我的 .cpp 文件中包含 2 个特定于平台的stdafx.h文件,但是当我尝试 #ifdef 时编译器不满意。
#ifdef _WIN32
#include "stdafx.h"
#elif _MAC
#include "MAC/stdafx.h"
#endif
您可能想知道为什么我在 Mac 代码中使用 stdafx.h,但目前这并不重要 :)。
当我尝试在 Windows 上编译代码时,我收到:Fatal Error C1018。我尝试用#ifdef 将其他头文件包含在同一个文件中,编译器很高兴。因此,看起来 Windows 不喜欢 stdafx.h 被 #ifdef-ed,或者 Windows 只允许#include stdafx.h 成为文件中的第一行。
所以我的问题是,为什么?
吉