不允许使用不完整的类型(C ++ VSCODE)

时间:2019-05-21 16:02:06

标签: c++ windows visual-studio-code

我只是使用容器类创建了一个数组a。但是,VScode的IntelliSense显示错误。这是选择排序的实现。

![IntelliSense Error

c_cpp_properties.json文件的内容如下

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.16299.0",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

该代码编译并成功运行。如何解决错误的IntelliSense错误?

1 个答案:

答案 0 :(得分:5)

Stop including bits/stdc++.h.

这是某些工具链的实现标头。不是给你的。

改为包含适当的标题:

#include <array>

(您的Intellisense引擎很可能无法从Linuxy平台访问此内部标头。)

顺便说一下,you're not allowed to choose names that begin with two underscores。所以也别这样。