在遇到用户创建的错误后,如何以编程方式强制编译器停止编译过程?

How can I programmatically force the compiler to stop the compilation process after it encountered a user created error?

在我的代码中,我使用 #error 预处理器指令来创建错误。但是,它仍在继续构建过程。

如何在遇到我的错误后以编程方式强制构建过程停止?

我正在为 Windows 10.

使用 Microsoft Visual Studio 2015,C++ v140,x86

From MSDN

The #error directive emits a user-specified error message at compile time and then terminates the compilation.

(已强调)

如果编译在 #error 指令之后继续进行,那么您的操作很奇怪,或者 MSVC 已损坏。