Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
gcc file.c -DDEFINITION > file_without_#ifdef.c possible??
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
derverstand
Guru
Guru


Joined: 15 Dec 2005
Posts: 511
Location: /dev/null

PostPosted: Tue Aug 29, 2006 11:36 am    Post subject: gcc file.c -DDEFINITION > file_without_#ifdef.c possible? Reply with quote

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:
Code:

...
something
...


Best regards!
Back to top
View user's profile Send private message
Ferdinando
Veteran
Veteran


Joined: 25 Nov 2003
Posts: 1027
Location: Gaeta (LT) - Italy

PostPosted: Tue Aug 29, 2006 11:53 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum