相关疑难解决方法(0)

在VS代码中,禁用错误"JSON中不允许注释"

我有时使用Visual Studio代码编辑包含注释的JSON文件.VS Code显示错误消息"JSON中不允许注释".最好禁用该错误消息(无需删除注释.)

在此输入图像描述

json visual-studio-code

94
推荐指数
3
解决办法
2万
查看次数

vscode“检测到#include 错误。请更新您的includePath

我正在尝试将 vscode 与 arduino 一起使用,但没有成功。问题似乎与库路径有关。但我一直无法解决这个问题!我在 linux 上。

"message": "#include 检测到错误。请更新您的 includePath。此翻译单元 (/home/harold/Arduino/Saaf_Curing/Saaf_Curing.ino) 的智能感知功能将由标签解析器提供。",

我不知道如何找到我的 includePath。我无法执行 vscode 中给出的任何建议。

我想知道 vs 代码是否是正确的方向,因为它看起来很复杂?

linux arduino include-path visual-studio-code

15
推荐指数
2
解决办法
3万
查看次数

VSCode c ++ task.json包含路径和库

IntelliSense使用c_cpp_properties.json >> includePath查找自动完成的标头,但我注意到我仍然需要在task.json >> task >> args内部指定包含路径来进行构建。

我在文档中发现includePath与我在“ -I”中指定的路径几乎相同:

您为此设置指定的路径与通过-I开关发送给编译器的路径相同。解析源文件后,IntelliSense引擎会在尝试解析它们的同时,将这些路径添加到您的#include指令指定的文件之前。这些路径不是递归搜索的。*

链接

  1. 我是否通过指定构建工具的args中的所有库和包含目录来正确设置VSCode?还是应该以其他方式进行?
  2. 有人可以用不同的词来解释includePath和browser之间的区别吗?解释链接对我来说并不完全清楚

这是我的c_cpp_properties.json的示例:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "D:/github/dependencies/SDL2-2.0.8/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "${workspaceFolder}/**"
                ]
            }
        }
    ],
    "version": 4
}
Run Code Online (Sandbox Code Playgroud)

和task.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "g++",
            "args": [
                "-g",
                "main2.cpp", …
Run Code Online (Sandbox Code Playgroud)

c++ g++ build visual-studio-code

5
推荐指数
3
解决办法
5290
查看次数

标签 统计

visual-studio-code ×3

arduino ×1

build ×1

c++ ×1

g++ ×1

include-path ×1

json ×1

linux ×1