解决从cmake编译TensorRT头文件找不到无法调试问题

正常情况下配置c_cpp_properties.json文件

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/home/sang/packages/TensorRT-8.5.1.7/include"                
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "linux-gcc-x64",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

配置方式修改c_cpp_properties.json文件

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
                
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "linux-gcc-x64",
            "configurationProvider": "ms-vscode.cmake-tools",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}

其中"compileCommands": "${workspaceFolder}/build/compile_commands.json"为新添加文件,build/compile_commands.json为执行cmake指令后生成的文件,在build目录下。

你可能感兴趣的:(TensorRT,TensorRT)