View previous topic :: View next topic |
Author |
Message |
derverstand Guru
Joined: 15 Dec 2005 Posts: 511 Location: /dev/null
|
Posted: Tue Aug 29, 2006 11:36 am Post subject: gcc file.c -DDEFINITION > file_without_#ifdef.c possible? |
|
|
Hi,
Let be file.c a source file which includes a section like:
Code: |
...
#ifdef DEFINITION
something
#endif
...
|
Is it possible to run only the preprocessor, such that gcc -DDEFINITION file.c produces an output file containing:
Best regards! |
|
Back to top |
|
|
Ferdinando Veteran
Joined: 25 Nov 2003 Posts: 1027 Location: Gaeta (LT) - Italy
|
Posted: Tue Aug 29, 2006 11:53 am Post subject: |
|
|
Use cpp (C pre-processor):
Code: | cpp -DDEFINITION file.c | grep -v '^#' |
Should work; the grep is meant to cut the additional info.
Bye _________________ La risposta, non la devi cercare fuori, la devi cercare dentro di te: e però è SBAGLIATA!
-- Corrado Guzzanti, "Pippo Chennedy Show", 1997 |
|
Back to top |
|
|
|