2

In my code I am using the #error preprocessor directive in order to create an error. However, it still continues the building process.

How can I force the building process programmatically to stop after encountering my error?

I am using Microsoft Visual Studio 2015, C++ v140, x86, for Windows 10.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Michiel Pater
  • 22,377
  • 5
  • 43
  • 57

1 Answers1

5

From MSDN

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

(Emphasis Added)

If compilation is continuing after the #error directive, then you're doing something odd, or MSVC is broken.

abelenky
  • 63,815
  • 23
  • 109
  • 159