Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97313

How can I pass the arguments from a Visual Studio Code task.json to a g++ command when the command includes a space

$
0
0

I have a Visual Studio Codetasks.json file to run a C++ file via g++:

{
"version": "2.0.0",
"tasks": [
    {
        "label": "echo",
        "type": "shell",
        "command": "g++",
        "args": [
            "-I ~/vcpkg/installed/x64-osx/include/",
            "test.cpp"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }
]
}

The problem is the resulting command > Executing task: g++ '-I ~/vcpkg/installed/x64-osx/include/' test.cpp < has single quotes so that won't work.

I took a look here and tried this:

{
"version": "2.0.0",
"tasks": [
    {
        "label": "echo",
        "type": "shell",
        "command": "g++",
        "args": [
            {
              "value": "-I ~/vcpkg/installed/x64-osx/include/",
              "quoting": "escape"
            },
            "test.cpp"
          ],
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }
]
}

The problem is the resulting command> Executing task: g++ -I\ ~/vcpkg/installed/x64-osx/include/ test.cpp < uses escape so has a \.

How can I generate the desired command:

g++ -I ~/vcpkg/installed/x64-osx/include/ test.cpp


Viewing all articles
Browse latest Browse all 97313

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>