What is the purpose of the preprocessor directive #error?

purpose of the preprocessor directive #error?

per https://stackoverflow.com/questions/5323349/error-directive-in-c:

It’s a preprocessor directive that is used (for example) when you expect one of several possible -D symbols to be defined, but none is.

#if defined(BUILD_TYPE_NORMAL)

define DEBUG(x) do {;} while (0) /* paranoid-style null code */

#elif defined(BUILD_TYPE_DEBUG)

define DEBUG(x) _debug_trace x /* e.g. DEBUG((_debug_trace args)) */


error “Please specify build type in the Makefile”

When the preprocessor hits the #error directive, it will report the string as an error message and halt compilation; what exactly the error message looks like depends on the compiler.

1 Like

Havent any solution of your problem.

I dont know…