Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why tasks.json: file format not recognized

I run VScode on ubuntu16, and test the helloworld.cpp. At first, I walked through all, then I tried to edit the tasks.json. I got the error. Ok, I cancel all the the change with rollback, it shows error aagin. I remove the helloworld folder and try again the helloworld. After Terminal > Configure Default Build Task and build, the error shows again. What's the wrong? It is got from vscode.

The error message:

Executing task: /usr/bin/g++ -g /home/liwenz/helloworld/.vscode/tasks.json -o /home/liwenz/helloworld/.vscode/tasks <

/usr/bin/ld:/home/liwenz/helloworld/.vscode/tasks.json: file format not recognized; treating as linker script /usr/bin/ld:/home/liwenz/helloworld/.vscode/tasks.json:1: syntax error collect2: error: ld returned 1 exit status The terminal process terminated with exit code: 1

tasks.json

{
"version": "2.0.0",
"tasks": [
    {
        "type": "shell",
        "label": "C/C++: g++ build active file",
        "command": "/usr/bin/g++",
        "args": [
            "-g",
            "${file}",
            "-o",
            "${fileDirname}/${fileBasenameNoExtension}"
        ],
        "options": {
            "cwd": "${workspaceFolder}"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }
]

}

the helloworld link is https://code.visualstudio.com/docs/cpp/config-linux

like image 322
liwen zeng Avatar asked Dec 17 '22 13:12

liwen zeng


1 Answers

You have to switch from the tasks.json file to the actual code you want to compile or debug.

like image 191
BabaBert Avatar answered Dec 27 '22 11:12

BabaBert