Set C++ include relative path for conda-installed Pybind11 header in VSCode and Emacs/Clangd

Viewed 16

I installed pybind11 using conda-forge, so need to add it to my C++ include path, in a Python project. I use both VSCode and Emacs/Clangd. In VScode, tried to add ${CONDA_PREFIX}/include in C/C++ extension settings UI, but it complains "Cannot find", since conda env cannot be activated for a C++ file. Also tried c_cpp_properties.json like below but doesn't work either. The editor always complains "cannot open source file "pybind11/pybind11.h"C/C++(1696)", so I have to use $HOME variable with absolute path to my conda environment. Is it possible to use this relative path ${CONDA_PREFIX}/include in VSCode to set up a include path? For Emacs with Clangd, how to set up this relative include path?

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${CONDA_PREFIX}/include"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "linux-clang-x64"
        }
    ],
    "version": 4
}
0 Answers
Related