5

I've heard that you can set values in your c++ program during compilation using g++'s -DN flag. Can anybody explain how? Thank you

Soroosh Khoram
  • 417
  • 1
  • 7
  • 11
  • 1
    have you read the man page for gcc? if I google `man gcc` and search for `-D` (and understand the preprocessor), it seems quite clear – KevinDTimm Mar 11 '13 at 12:20

1 Answers1

13

-DXXX flag is just like adding #define XXX. So -DN=2 is just like #define N 2.

And you can pass values during compilation using this flag.

Reference:

Kun Ling
  • 2,211
  • 14
  • 22