1

I have this config for cpp, but when i use vimspector#Launch, error appears, it's connected with this string "shell": "g++ -o ${workspaceRoot}/test -g -std=c++2a ${workspaceRoot}/*.cpp" All config code:

{
  "adapters": {
    "custom-codelldb": {
      "extends": "CodeLLDB",
      "command": [
        "$HOME/Development/vimspector/CodeLLDB/build/adapter/codelldb",
        "--port", "${unusedLocalPort}"
      ]
    },
    "CodeLLDB - StopOnEntry": {
      "extends": "custom-codelldb",
      "name": "CoHostingLLDB"
    },
    "custom-cpptools": {
      "extends": "vscode-cpptools",
      "command": [
        "$HOME/Development/vimspector/MIEngine/bin/Debug/vscode/OpenDebugAD7"
      ]
    }
  },
  "configurations": {
    "CodeLLDB": {
      "adapter": "CodeLLDB",
      "variables": {
        "BUILDME": {
          "shell": "g++ -o ${workspaceRoot}/test -g -std=c++2a ${workspaceRoot}/*.cpp"
        }
      },
      "configuration": {
        "request": "launch",
        "expressions": "native",
        "program": "${workspaceRoot}/test"
      }
    }
  }
}

If i write g++ -o ${workspaceRoot}/test -g -std=c++2a ${file} in shell istead of "shell": "g++ -o ${workspaceRoot}/test -g -std=c++2a ${workspaceRoot}/*.cpp" it works fine, but i need compile multiple files automatically.

1
  • Use vimspector's dedicated support channels. Commented Apr 16, 2024 at 8:02

1 Answer 1

0

The problem was that in this context the "*" symbol is not correctly interpreted by the command line, so the command "sh" needs to be used.

"shell": ["sh", "-c", "g++ -o \"${fileDirname}/test\" -g -std=c++2a \"${fileDirname}\"/*.cpp"]

Escaping is necessary for paths with spaces to work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.