----A.h-----#ifndef A#define A#include <Debug>class A { public: static void foo(const QString& str);}#endif-------------------A.cpp-------void A::foo(const QString& str){ bool empty = str.IsEmpty();#ifdef PPRINT if ( empty ) qDebug() << "Warning: empty";#else Q_ASSERT_X(!empty, "A", "empty str");#endif //....some logic....}-----------------main.cpp--------#define PRINT#include "A.h"int main(){ A::foo(""); return 0;}-------