vscode include error when remotely debugging c++ program

Viewed 20

problem

I'm using vscode to remotely connect to linux server. When I try to debug on my cpp program, which includes these header files under one directory

#include "codec_def.h"
#include "codec_app_def.h"
#include "codec_api.h"

it always come up with an include error:

codec_def.h: No such file or directory

the same error shows up to codec_app_def.h when I comment out the first header file codec_def.h

I have tried

I googled on this problem and find one solution-include path to the c_cpp_properties.json file. Here is the path screenshot, path screenshot

and my newly updated c_cpp_properties.json file is like this, I added ${workspaceFolder}/codec/api/svc/ to includePath,

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/codec/api/svc/",
                "/usr/include",
                "${workspaceFolder}/**",
                "${workspaceFolder}/codec/decoder/core/inc",
                "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7",
                "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/x86_64-redhat-linux",
                "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/backward",
                "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include",
                "/usr/local/include",
                "/opt/rh/devtoolset-7/root/usr/include"
            ],
            "defines": [],
            "compilerPath": "/opt/rh/devtoolset-7/root/usr/bin/g++",
            "cStandard": "c11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}

but I still get the same error and I can't figure out why and how to solve it.

in case of other problems, here are tasks.json file

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++ build active file",
            "command": "/opt/rh/devtoolset-7/root/usr/bin/g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "/opt/rh/devtoolset-7/root/usr/bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: /opt/rh/devtoolset-7/root/usr/bin/g++"
        }
    ],
    "version": "2.0.0"
}

and launch.json file

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    
        
        {
            "name": "(gdb) run and debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [
                "/root/compress/losslessh264/tibby.264",
                "/fordebug/b.pip"
            ],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "set up pretty printing",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description":  "set desassembly flavor Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++ build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        },
        {
            "type": "bashdb",
            "request": "launch",
            "name": "Bash-Debug (select script from list of sh files)",
            "cwd": "${workspaceFolder}",
            "program": "${command:SelectScriptName}",
            "args": []
        },
        {
            "type": "bashdb",
            "request": "launch",
            "name": "Bash-Debug (simplest configuration)",
            "program": "${file}"
        }


    ]
}

I have been stuck in this problems for days, it will be a great help if you know the answer, thank you in advance :)

0 Answers
Related