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.
以前可能有人问过这个问题,但我找不到。
有没有办法在编译时确定我的代码是否正在编译cl.exe?
cl.exe
我将使用它有条件地包含(在预处理期间,通过#ifdef)某些#pragma仅由cl.exe.
#ifdef
#pragma
如果您想对cl.exe版本做出决定,请使用_MSC_BUILD.
_MSC_BUILD
但是,首先检查_MSC_VER, 因为_MSC_BUILD在 VS 2005 中不可用。
_MSC_VER
我想你可以检查一下_MSC_BUILD宏。