Search code examples
c++compilationg++localcompiler-flags

what '-DLOCAL' flag does in C++ compilation


I want to know what -DLOCAL flag of C++ compilation does ?
which is used as :

g++ -std=c++17 -Wshadow -Wall -o "%e" "%f" -g -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -DLOCAL

thanks in advance.


Solution

  • one use that I found is compiled with -DLOCAL flag allows us to run a statement like cerr, which is for testing

    cerr << "some variable for testing";

    if we remove -DLOCAL flag in the compilation, cerr will not be showing any output on the console.

    this is helpful even we forget to remove all those testing statements it will not affect the program. because we are not compiling with -DLOCAL in general.
    thanks