包括文件夹结构未按预期工作的路径

时间:2017-05-04 11:08:53

标签: c++ visual-studio-code

我是VS Code的新手,目前正在设置我的C ++项目。我正在使用Boost库,并期望在配置文件 c_cpp_properties.json 中配置包含路径时遇到一些问题。

我的配置文件:

{
"configurations": [
    {
        "name": "Mac",
        "includePath": [
            "${workspaceRoot}",
            "/usr/include",
            "/usr/local/include"
        ],
        "defines": [],
        "browse": {
            "path": [
                "/usr/include",
                "/usr/local/include"
            ],
            "limitSymbolsToIncludedHeaders": true,
            "databaseFilename": ""
        }
    },
    {
        "name": "Linux",
        "includePath": [
            "${workspaceRoot}",
            "/usr/include",
            "/usr/local/include"
        ],
        "defines": [],
        "browse": {
            "path": [
                "/usr/include",
                "/usr/local/include"
            ],
            "limitSymbolsToIncludedHeaders": true,
            "databaseFilename": ""
        }
    },
    {
        "name": "Win32",
        "includePath": [
            "${workspaceRoot}",
            "C:/Program Files (x86)/Windows Kits/8.1/Include/um",
            "C:/Program Files (x86)/Windows Kits/8.1/Include/shared",
            "C:/Program Files (x86)/Windows Kits/8.1/Include/winrt",
            "D:/SVN/kWorld/kWorld/src",
            "D:/Programme/boost_1_64_0"
        ],
        "defines": [
            "_DEBUG",
            "UNICODE"
        ],
        "browse": {
            "path": [
                "C:/Program Files (x86)/Windows Kits/8.1/Include/um",
                "C:/Program Files (x86)/Windows Kits/8.1/Include/shared",
                "C:/Program Files (x86)/Windows Kits/8.1/Include/winrt"
            ],
            "limitSymbolsToIncludedHeaders": true,
            "databaseFilename": ""
        }
    }
]

}

然而,VS Code仍然为我提供了指令中包含路径中未找到的包含文件

#include <boost/serialization/access.hpp>

我认为问题在于,包含的标头不是直接位于其中一个引用的目录中,而是位于较低的目录中。但是,include伪指令具有相对于 D的完整路径:/ Program / boost_1_64_0

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

Boost标头可能位于D:/Programme/boost_1_64_0/include/boost-1-64/或类似位置 图书馆应该在D:/Programme/boost_1_64_0/lib/

尝试使用包含包含头文件的boost文件夹的文件夹的完整路径。