无法在vscode中包含QTime

时间:2019-12-10 01:03:58

标签: qt visual-studio-code

我将c_cpp_properties.json设置为:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/local/Cellar/qt/5.13.2/include/QtCore"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

它报告:包括检测到的错误。请更新您的includePath。该翻译单元(/Users/.../.cpp)的花粉被禁用.C / C ++(1696) 无法打开源文件“ QtCore / qstring.h”(“ QTime”的依赖性)`

2 个答案:

答案 0 :(得分:0)

编译器正在寻找"QtCore/qstring.h"。根据您已经指定的包含路径,我想它将位于...

  

“ / usr / local / Cellar / qt / 5.13.2 / include”

因此您需要将其添加到包含路径列表中。

答案 1 :(得分:0)

添加

"compileCommands": "${workspaceFolder}/build/compile_commands.json",

到您的配置文件。

请参见Visual Studio Code on macOS + Qt + Intellisense