Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC on Linux: Some minor issues #7252

Open
thernstig opened this issue May 5, 2024 · 4 comments
Open

GCC on Linux: Some minor issues #7252

thernstig opened this issue May 5, 2024 · 4 comments
Assignees
Labels
doc-enhancement suggested addition or improvement

Comments

@thernstig
Copy link
Contributor

thernstig commented May 5, 2024

https://code.visualstudio.com/docs/cpp/config-linux

From now on, the play button will read from tasks.json to figure out how to build and run your program. You can define multiple build tasks in tasks.json, and whichever task is marked as the default will be used by the play button.

Is the bold incorrect?

Isn't the play button is about launch configurations i.e. launch.json. The current launch configuration contains a preLaunchTask for which task it will run.

Next, you'll create a tasks.json file to tell VS Code how to build (compile) the program. This task will invoke the g++ compiler to create an executable file from the source code.

This line can probably be removed altogether. It mentions tasks.json which has already been described earlier on that page.

@thernstig thernstig changed the title GCC on Linux: Incorrect info about default task GCC on Linux: Some minor issues May 5, 2024
@AlexandraKemperMS
Copy link
Collaborator

AlexandraKemperMS commented May 10, 2024

Hi @thernstig, thanks for reaching out. In this case, the bold text is correct. The single file playbutton has too modes, a "run" mode and a "debug" mode. For "run", the play button needs to build your code first. This information is provided by tasks.json. Think of tasks.json as a way to list command line commands in a file - for example, the command on how to build your program. launch.json contains debugging information/settings, or in the case of the playbutton, the playbutton actually creates a "quick debug" configuration on the fly if you do not have a launch.json. Note that the playbutton is a way to quickly run a single file - which is why it chooses the default task in your tasks.json. Please let me know if that clears things up or if you have any further questions.

@thernstig
Copy link
Contributor Author

thernstig commented May 13, 2024

@AlexandraKemperMS got it, thanks. What confused me was that I confused the play button up there as being similar to the play button inside the "Run and Debug view" here https://code.visualstudio.com/docs/editor/debugging#_run-and-debug-view.

They look the same, so I though it was the same. But now I see the play button in a .c or .cpp file is actually something your C/C++ extensions adds specifically.

But that means "your" play button uses launch.json whilst the other, identical play button under "Run and Debug" uses tasks.json.

Aside: I still think

Next, you'll create a `tasks.json` file to tell VS Code how to build (compile) the program. This task will invoke the g++ compiler to create an executable file from the source code.
could be removed as creating the tasks.json has been done earlier in that document.

@AlexandraKemperMS
Copy link
Collaborator

That's really interesting - you are right, there are two play buttons, which can be confusing. The one on the top right is just for a single file, while the one in the "Run and Debug" view is for your entire project. We need to make this more clear.
Good point about the docs, we can take out that line & should do a full freshness pass.

@ntrogh
Copy link
Contributor

ntrogh commented Dec 17, 2024

@AlexandraKemperMS Can you follow-up on this issue?

@ntrogh ntrogh added the doc-enhancement suggested addition or improvement label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement suggested addition or improvement
Projects
None yet
Development

No branches or pull requests

3 participants