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
Asked
Active
Viewed 8,715 times
5
-
1have 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 Answers
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