程式語言 - GNU - 如何在Preprocessor列印定義的數值



參考資訊:
https://stackoverflow.com/questions/1562074/how-do-i-show-the-value-of-a-define-at-compile-time

main.c

#include <stdio.h>

#define TEST        1234

#define STR(x)      #x
#define XSTR(x)     STR(x)
#pragma message     "VAL:" XSTR(TEST)

int main(int argc, char **argv)
{
    return 0;
}

編譯測試

$ gcc main.c -o gg
    main.c:7:9: note: #pragma message: VAL:1234