【问题标题】:Visual Studio Code Property Console not allowed errorVisual Studio Code 属性控制台不允许错误
【发布时间】:2021-04-27 19:57:38
【问题描述】:

我是编程新手,我正在做一些书中的这些问题。并且被困在这个关于三角形面积的问题中。”不允许使用属性控制台 em>"。是因为 math.h 吗? 因为相同的代码在 online-gdb 上是完全可用的。

这是 lauch.json 的内容

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "gcc - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "console": "externalTerminal",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: gcc build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

【问题讨论】:

  • 除此之外:在使用sqrt(mult) 之前检查mult >= 0,即它是一个真正的三角形。
  • 抱歉,新来的
  • @WeatherVane 如果它们都不是,那将是正确的。
  • @AnttiHaapala 没有边说 1, 1, 3 不能构成三角形。文本在一个地方说“矩形”,但公式​​和输出是三角形。
  • @WeatherVane 啊真的:D ENOCOFFE

标签: c visual-studio-code


【解决方案1】:

只需从launch.json 文件中删除console 属性即可。

【讨论】:

  • "message": "当只有一个必须验证时匹配多个模式。",
  • 该消息来自哪里?看来老问题解决了,新问题又出现了。不确定是否相关。
  • 在launch.json中删除控制台行后,它会更改为匹配多个模式
  • 在哪个文件中说明会发生这种情况?我认为这只是一个警告:github.com/microsoft/vscode/issues/86738
  • 但老实说,如果您只是使用谷歌,您可以轻松找到与这些问题相关的讨论..
【解决方案2】:

替换

"console": "externalTerminal"

"externalConsole": true

这个版本的自动生成的launch.json似乎不支持“控制台”属性。然而,这确实为我摆脱了警告消息。

【讨论】:

  • 这与我得出的解决方案相同。我在 Microsoft 文章中找到了解决方案:Getting Started with GCC。有谁知道什么软件负责自动生成这个launch.json?我想发布一个问题或看看是否已经发布了一个问题。
猜你喜欢
  • 2020-07-25
  • 1970-01-01
  • 2019-11-18
  • 1970-01-01
  • 2021-03-28
  • 1970-01-01
  • 2021-05-17
  • 1970-01-01
  • 2016-09-10
相关资源
最近更新 更多