Hello, and welcome to the 69th tutorial in the c++ program series. And in this part, we'll be looking at the preprocessor error directive, error directive for the compilation error. By default, the definition, C underscore underscore c++ is defined. But if it isn't, then they know c++ compiler, we will use this to demonstrate preprocessor error directive. So let me just go ahead and open up a project. Some of these preprocessor directives, they are in a way default already implemented the line directive error directive, but you can have a bit more control over them.
You can compose specific error messages. So when you look at it, you know, yeah, I know exactly where that's from. I know where to go and maybe even how to fix it. Instead of just getting the sort of default error message in the component doesn't know how your program is structured. Waste meant to do. So to do this, you just do.
Here just do hash, if not defined, which we call it before, then underscore, underscore, underscore c++. And then in here we'll do hash error. What we're going to do is either specify what your error is no quotation mark on it, it's often called no c++ compiler detected. Ash, and there might be one this there we go, one that we both see enough in in there because obviously, the c++ compiler if detected, but if I were to just this, you want us to touch on death. Once underscore underscore c runner it says no c++ compiler detected even though they differ from compiler, I've just undefined the c++ definition. Therefore from this error, or what we could do is if it is defined, we will throw an error anyway.
But the error can be slightly different for that but it could be within the c++ compiler detected, then we say that the error c++ compiler detected policy, you will want it like this. This is a quick nap of how to use the preprocessor directive. In the next part of this series. I'm going to show you how to use the preprocessor source file inclusion directive. We've already used it several times it basically this program is going to go over a lot more. If you have any questions feel free to message us at support at sonar systems coda UK or the recording for for the source code world In the description, you can comment and we should do this directly messages via YouTube as well.
And as usual, thanks for watching and I hope you have a great day.