在Visual Studio代码中使用C(mac)

时间:2018-06-14 16:44:27

标签: c visual-studio

到目前为止,我在Visual Studio上使用Python并且运行良好。因为我现在需要进入C语言,我认为我也可以使用VS这种语言(而不是像推荐的那样使用Xcode,因为我非常喜欢VS的美学)。

我在VS中安装了C / C ++调试器。然后我一直试图启动以下程序:

#include <stdio.h>

int main() {
   /* my first program in C */
   printf("Hello, World! \n");

   return 0;
}

当我尝试运行它时,它会说:错误无法启动程序&#39; 安装代码所在的文件&#39;。 我试图谷歌问题并尝试了不同的东西,但我没有设法解决这个问题。这是我的launch.json和我的tasks.json的样子:

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${file}"
        }
    ]
}

tasks.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "build",
            "command": "msbuild",
            "args": [
                // Ask msbuild to generate full paths for file names.
                "/property:GenerateFullPaths=true",
                "/t:build"
            ],
            "group": "build",
            "presentation": {
                // Reveal the output only if unrecognized errors occur.
                "reveal": "silent"
            },
            // Use the standard MS compiler pattern to detect errors, warnings and infos
            "problemMatcher": "$msCompile"
        }
    ]
}

0 个答案:

没有答案