pragma(msg) and pragma(lib)

Get to learn about pragma(msg) and pragma(lib) in this lesson.

We'll cover the following

Pragmas

Pragmas are a way of interacting with the compiler. They can be used for providing special information to the compiler as well as getting information from it. Although they are useful in non-templated code, pragma(msg) can be helpful when debugging templates.

Every compiler vendor is free to introduce their special pragma directives in addition to the mandatory ones, which will be covered in this chapter.

pragma(msg)

pragma(msg) prints a message to stderr during compilation. No message is printed during the execution of the compiled program. For example, the following pragma(msg) is being used for exposing the types of template parameters, presumably during debugging:

Get hands-on with 1200+ tech skills courses.