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

北城余情 提交于 2019-12-23 02:05:45

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/33263158/how-can-i-programmatically-force-the-compiler-to-stop-the-compilation-process-af

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!