Другие ответы устарели, поскольку API llvm и clang обновились , я попробовал этот код
Код: Выделить всё
void print_system_header_paths() {
clang::CompilerInstance CI;
auto Invocation = std::make_shared();
CI.setInvocation(Invocation);
// I can eliminate this line to get rid of an error but other answer suggested creating a preprocessor
CI.createPreprocessor(clang::TranslationUnitKind::TU_Prefix);
const clang::HeaderSearchOptions &HSOpts = CI.getInvocation().getHeaderSearchOpts();
if (HSOpts.SystemHeaderPrefixes.empty()) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78251553/get-search-paths-for-headers-in-the-standard-library-in-clang[/url]
Мобильная версия