hello, sometimes i see that certain projects write something to the output during compilation.
how can that be achieved in MSVC++
thanks!
hello, sometimes i see that certain projects write something to the output during compilation.
how can that be achieved in MSVC++
thanks!
You want to include something like this in your source code:
#pragma message("Hello World")
use #pragma message
e.g.
#define MESSAGE(t) message(__FILE__ "(" STRINGXXX(__LINE__) ") : " t)
#define STRINGXXX(x) STRINGYYY(x)
#define STRINGYYY(x) #x
then if you put
#pragma MESSAGE("TODO: testing")
it will appear as a clickable message just like the normal compiler messages
You can use #pragma message in one of your source files to output a string when that file is preprocessed.
Also, when a custom, pre- or post- build step is executed, the "description" field is echoed to standard output.
As Timo Geusch said: the #pragma message
directive is used for that.
As an exotic side effect of template metaprogramming, it's also possible to use the compiler as a calculator :)
template<int i> struct Message;
template<int i> struct Fac {
static const int v = i * Fac< i-1 >::v;
};
template<> struct Fac<1> { static const int v = 1; };
Message< Fac<10>::v > m;
will result in the output message
Line 10: error: aggregate 'Message<3628800> m' has incomplete type and cannot be defined