如何配置 VSCode 智能感知以查看 LLVM 包含

问题描述 投票:0回答:1

LLVM 教程告诉您使用

llvm-config
将命令行参数传递给编译器。但是,您不能只在 VSCode 配置中调用
llvm-config
。那么,当 VSCode 用红色波浪线强调你的包含内容并说出这样的话时,你会怎么做?

#include errors detected. Please update your includePath.
cannot open source file "llvm/IR/LLVMContext.h"
cannot open source file "llvm/IR/Module.h"
cannot open source file "llvm/IR/IRBuilder.h"
c++ visual-studio-code llvm
1个回答
0
投票

您无法在 VSCode 设置中使用

llvm-config
,但幸运的是您只需要包含目录即可。

您可以像这样获取 LLVM 包含目录:

llvm-config --include-dir

如果您单击 VSCode 中波形曲线上的“快速修复”选项并选择

Edit "includePath" setting
,它将带您进入
C/C++ Configurations
设置 UI。您还可以使用 Command/Control-Shift-P 并选择
C/C++: Edit Configurations (UI)
到达此处,或者根据需要选择
JSON
选项。

将包含目录粘贴为

Include path
下的新行。或者在 JSON 中,将其放在这里:

{
    "configurations": [
        {
            "includePath": [
                "HERE"
            ],
        }
    ],
}
© www.soinside.com 2019 - 2024. All rights reserved.