I have a .cpp file (text). I want to get a list of all the file names that are included (#include) in this file. What is the best way to do this? (It is necessary to implement it in C ++)
gcc -M source.cpp
Replace -Mwith -MMif you are not interested in the system.
-M
-MM
Assuming you have find or grep, something like that:
g++ -E source.cpp | grep '\# 1 '