5

I have a number of C/C++ project files. I'd like to know the full list of preprocessor symbols used by the files. Is there a flag to gcc, or is there some tool I can use to get this list.

Optionally, if the tool also told me the list of symbols defined by the file, that would be great.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Paul Biggar
  • 27,579
  • 21
  • 99
  • 152

1 Answers1

8

Use gcc -E -dM <file_list> - preprocess, then output #defines.

My gcc is a tad rusty, so I'm not sure whether or not you explicitly need the -E, but try both?

For further reference, see this

Ben Stott
  • 2,218
  • 17
  • 23
  • Not to be a pest, but could I trouble you to mark this as the correct answer? This way it shows up as answered for others who might have the same problem! – Ben Stott Apr 10 '11 at 07:42