-3

Whenever i click the run button on my cpp code the top search bar drops down with multiple options that im not familiar with. i would just like it to run the code in my output or terminal.

3
  • 4
    Vscode is not beginner-friendly. Time you will waste fiddling with its infinite half-baked features is better spent elsewhere. Commented Oct 28 at 5:50
  • 2
    My advice if you want to use VSCode with c++ is to follow the official documentation: https://code.visualstudio.com/docs/cpp/config-mingw My second piece of advice is to forget that the code runner extension exists for c or c++. It only works for the simplest source code anyways. Once you get more than 1 file or need a library it no longer works for you it works against you. Once you learn the basics you can use CMake and the CMakeTools extension once your code becomes more complicated and you need libraries. Commented Oct 28 at 16:30
  • stackoverflow.com/q/77652090/11107541 Commented Oct 28 at 20:45

1 Answer 1

3

The best thing you could do is download Visual Studio 2022 which is kinda better for C++/C/C# related programs, you could follow this guide by microsoft: https://learn.microsoft.com/en-gb/cpp/overview/visual-cpp-in-visual-studio?view=msvc-170 or follow any recent youtube tutorial.

However if you need to use VS Code then first make sure you have the C/C++ extension installed it is from Microsoft. Then it is also recommended to install Code Runner extension as it helps run the code easily, it will show output in the Output Panel, you could also configure it to show the output in terminal if you want.

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

3 Comments

ya i tried on with the c/c++ and code runner extension but i cant figure out how to get it to default running the code to the output panel or terminal. It ok though i ended up finding another beginner tutorial for visual studio 2022 and that is working much better. Thank you!
Code Runner is only a good idea if your programs are toy examples in a single file and you have no idea how to use cmake or make.
@JesperJuhl even then I'm pretty sure the cpptools extension provides such functionality to compile and run/debug single files. || unrelated- I'm not a fan of this answer. the question is about C++ and VS Code. though apparently this answer is satisfying to the asker.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.