Sample Header Ad - 728x90

C program opens terminal in VSCode of MacBook Air M1

1 vote
0 answers
185 views
I am running this code in VSCode on my MacBook Air M1
#include

int main(){
    double pi=(double)355/113,r;

    printf("Enter the radius of the circle\n");
    scanf("%lf",&r);

    printf("The area of the circle is: %f\n",pi*r*r);
    return 0;
}
On clicking run c/c++ button, it opens an instance of the terminal instead of the VSCode integrated terminal.See image here The debug console loads .dylib files This is my launch.json
{
    "configurations": [
        {
            "name": "C/C++: clang build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb",
            "preLaunchTask": "C/C++: clang build active file"
        }
    ],
    "version": "2.0.0"
}
this is my tasks.json
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: clang build active file",
            "command": "/usr/bin/clang",
            "args": [
                "-fcolor-diagnostics",
                "-fansi-escape-codes",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
How do I make it run in the integrated console? Also, this problem is unique to C, Python & Java run in the VSCode integrated terminal without issues (and without CodeRunner)
Asked by Kartikey Doshi (11 rep)
Sep 3, 2023, 07:41 PM
Last activity: Sep 4, 2023, 12:00 AM