Using GCC on Linux (Mint)
I have a line of code ...
#pragma message "blah blah blah"
When I run GCC I get this output with no warning, errors, etc ...
src/source_file.c:29:9: note: ‘#pragma message: blah blah blah’
29 | #pragma message "blah blah blah"
I see tutorials specifying how to use #pragma message ...
but I didn't know what to expect from compiler output.
The #pragma
is a preprocessor directive that provides additional information to the compiler. They are not part of the core language but allow for various compiler-specific customizations and optimizations. The correct syntax for #pragma message
requires the message to be enclosed in parentheses and double quotes.
The pragma message can be used to output a message during compilation. For example if you write in the main.c file :
#pragma message("Compiling " __FILE__)
You should have this output :
Compiling main.c