Intellisense无法检测到库.VSCode CLang C ++

时间:2019-12-30 22:21:24

标签: c++ visual-studio-code clang llvm intellisense

#include <iostream>

int main()
{
   std::cout << "Hello world!" << std::endl;

   return 0;
} 

Clang编译器编译此代码,并提供我可以运行并查看“ Hello world!”的常规可执行文件。在控制台中。但是intellisense说"namespace std has no member cout"。智能感知不仅看到STL符号,还看不到任何符号。例如。我有SFML,并且intellisense无法检测其符号。

#include <SFML/Graphics.hpp>

int main()
{
   sf::Sprite s;

   return 0;
} 

什至没有检测到我声明的符号。

我已经安装了C ++扩展。我尝试将“ C_Cpp.intelliSenseEngine ”设置为“ 标签解析器”,在这种情况下,Intellisense根本不起作用(没有错误,没有花键)。

task.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build with Clang",
            "type": "shell",
            "command": "clang.exe",
            "args": [
                "-std=c++17",
                "-stdlib=libc++",
                "${workspaceFolder}\\source\\main\\Main.cpp",
                "-ID:\\project\\Ter MS VS\\include",
                "-LD:\\project\\Ter MS VS\\lib\\x86\\lib",
                "-lsfml-graphics",
                "-lsfml-system",
                "-lsfml-window",
                "-o",
                "${workspaceFolder}\\TerCl.exe",
                "--debug",
                "-v"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": []
        }
    ]
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "CLTer",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}\\TerCl.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "miDebuggerPath": "D:/Programs/LLVM/bin/lldb.exe",
            "logging": {
                "trace": true,
                "traceResponse": true,
                "engineLogging": true
            }
        }
    ]
}

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "CLang",
            "includePath": [
                "${workspaceFolder}\\source\\**",
                "D:\\project\\Ter MS VS\\include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "D:/Programs/LLVM/bin/clang.exe",
            "intelliSenseMode": "clang-x64",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "compilerArgs": []
        }
    ],
    "version": 4
}
我的PC的

OS是Windows x64 。

0 个答案:

没有答案