'Why can't VSCode locate the header files? - fatal error: No such file or directory

I am running Ubuntu 18.04.1 and trying to compile the file DeviceInfo.cpp which is located in ~/Desktop/Cpp/me_surfaceControl/src. Many header files are required, including GenicamSystem.h which is located in ~/Desktop/surfaceControl/C++/include.

I added the header file locations to the IntelliSense Configurations as well as to c_cpp_properties.json.

Even though the locations are specified, I am getting the error /home/nitish/Desktop/Cpp/me_surfaceControl/src/DeviceInfo.cpp:10:10: fatal error: GenicamSystem.h: No such file or directory #include <GenicamSystem.h> Error message, code, and vscode configurations

I have tried to force include the header file in the advanced configurations, with no outcome. I also tried to include the header like this: #include <include/GenicamSystem>, which was also useless.

This how the tasks.json file looks like:

   {
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "Build C++ using g++ 7",
            "command": "/usr/bin/g++-7",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}",
                "-Wall",
                "-I~/Desktop/surfaceControl/C++/include",
                "-I~/Desktop/surfaceControl/C/include",
                "-I~/desktop/surfaceControl/MEDataTypes/include",
                "-I~/Desktop/surfaceControl/MEPointCloud/include"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "compiler: /usr/bin/g++-7"
        }
    ]
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source