【发布时间】:2021-01-18 02:23:25
【问题描述】:
我正在尝试运行具有以下标头的 C++ 程序。
#include <clang-c/Index.h>
它的主要功能是这样的。
int main(int argc, char **argv) {
if (argc < 2) {
std::cerr<< "Missing argument: path to source\n";
return -1;
}
CXIndex index = clang_createIndex(0, 1);
CXTranslationUnit tu;
.....remaining program.
我已经从以下链接下载并安装了 LLVM 10.0 Windows(64bit)。
LLVM download link windows
我还从以下链接下载并安装了适用于 Windows(64 位)的 CMake 3.18。
CMake download link windows
我还安装了 Visual Studio Community 15 2017。
Clang++ 命令适用于简单的 C++ 程序。但是当我尝试用这个头文件运行我的程序时。
clang++ node.cpp
我收到一个错误。
fatal error: 'clang-c/Index.h' file not found
我检查了这个头文件位于 C:\Program Files\LLVM\include\clang-c。但是当我运行时,我得到了错误。
我检查了我的环境变量,发现有这两条路径。
C:\Program Files\CMake\bin
C:\Program Files\LLVM\bin
我搜索了很多,但在谷歌上没有找到任何解决方案。请告诉我我做错了什么。或者如果它需要不同的命令来运行这个程序。
【问题讨论】: