Published on

VSCode 配置 C/C++ 头文件路径

步骤

  1. 在项目根目录创建 .vscode/c_cpp_properties.json 文件
  2. 添加以下内容(以 Linux/Clang 为例):
{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/include"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

Example

├── include
│   └── handle.hpp
├── README.md
└── src
    ├── cuda_error_check.h
    └── main.cu

THE END