4

I'm about to start learning C and chose VS Code with GCC as my compiler. I added a hello world program to test it out and I get the following popup:

enter image description here

I have zero experience with any of this so I would greatly appreciate the help. I followed the Open launch.json option and did not understand how that was relevant to my problem. It gave me the following:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "name": "(Windows) Launch",
        "type": "cppvsdbg",
        "request": "launch",
        "program": "enter program name, for example ${workspaceFolder}/a.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false
    }
]

}

I have no clue what to do. I tried looking through StackOverflow for similar problems and have had no success.

4
  • code.visualstudio.com/docs/languages/cpp
    – rioV8
    Mar 15, 2020 at 17:23
  • 1
    You didn't change "enter program name, for example ${workspaceFolder}/a.exe" to "${workspaceFolder}/main.exe".
    – S.S. Anne
    Mar 15, 2020 at 17:36
  • Do you mean that I have to go and change the text in that line to my folder name? Mar 15, 2020 at 18:44
  • Actually, I hit the run button after installing the Code Runner extension and it worked. Can someone explain to me the difference between this and what I posted above? Mar 15, 2020 at 19:05

2 Answers 2

2

Regarding this post:

Q: What is the difference between * when it come before and after something in C?

A: Look at the ""right-left" rule:

Regarding this question:

Q: Why am I getting “launch:program does not exist” in VS Code?

A: If you look carefully, the actual error is launch: program "" does not exist

In other words, VSCode was looking for some program named "" (empty string), and not finding it.

You simply need to configure your environment (including, as you discovered, the runner), and define everything (especially "program") correctly in your launch.json.

1
  • What is program? Is it the filepath to the cpp file? The parent folder? Something else?
    – MoreFoam
    May 9 at 18:36
0

After installing .net runner the problem was solved at my end.

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.