lundi 2 novembre 2015

Setting #define identifier using command line argument

I'm writing a python script to run a compiled binary whose source was written in C++, varying a parameter as controlled using a command line argument.

e.g. os.system("./my_program " + my_arg)

Let's say it's too much hassle changing this parameter from main().

Instead I'd like to set it in some included header file using #define MY_PARAM my_val where my_val is taken as a command line argument when the program is run.

I'm using gcc to compile

Any ideas?

Aucun commentaire:

Enregistrer un commentaire