简体   繁体   中英

Extract all included files in cpp

I have .cpp file (text).I want to get the list of all files names which are included (#include) to this file. What is the best way to do it?(Need to implement it in C++)

gcc -M source.cpp

如果您不关心系统包含,请将-M替换为-MM

假设你有一个“查找”或“grep”,这些内容如下:

g++ -E source.cpp | grep '\\# 1 '

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM