问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/5603870/how-can-i-get-a-list-of-all-preprocessor-symbols-used-or-defined-within-a-file