【发布时间】:2020-02-20 01:01:58
【问题描述】:
我正在尝试在 Python 中使用 clang.cindex,但是当我尝试传入一个虚拟标头时,它不起作用:
import sys
from clang import cindex
tu = cindex.Index.create().parse('t.cc', args=[], unsaved_files=[
('t.h', ''),
('t.cc', '#include "t.h"'),
])
for diag in tu.diagnostics:
sys.stderr.write(diag.format() + "\n")
我收到的错误是:
t.cc:1:10: fatal error: 't.h' file not found
发生了什么事?为什么能找到t.cc,却找不到t.h?
【问题讨论】: