So i'm facing this problem since the start of time, I'm using Visual studio 2013 ultimate and when I make a project it works perfectly fine in the start but as the project grows a bit complex i.e I add more classes to it, the debug option is replaced by some stupid attach option which I don't even know how to handle, so please be kind enough to guide me how I can get my relevant option back. How to sign in to Visual Studio When you start Visual studio for the first time, you're asked to sign in and provide some basic registration information. You should choose a Microsoft account or a work or school account that best represents you. Because the Developer Tools teams (especially.NET and Roslyn) do so much work in GitHub, you’ll start to see check-ins that indicate that we’re laying the foundation for Visual Studio 2019, and we’re now in the early planning phase of Visual Studio 2019 and Visual Studio for Mac.
- Microsoft Visual Studio Code For Mac Won't Start Up
- Download Visual Studio Code For Linux
- Microsoft Visual Studio Code For Mac Won't Start In Safe
- Visual Studio Code For Chromebook
- Download Visual Studio Code For Windows
Microsoft's Visual Studio Code editor is quite nice, but it has no default support for building C++ projects.
How do I configure it to do this?
Peter Mortensen12 Answers
There is a much easier way to compile and run C++ code, no configuration needed:
- Install the Code Runner Extension
- Open your C++ code file in Text Editor, then use shortcut
Ctrl+Alt+N
, or pressF1
and then select/typeRun Code
, or right click the Text Editor and then clickRun Code
in context menu, the code will be compiled and run, and the output will be shown in the Output Window.
Moreover you could update the config in settings.json using different C++ compilers as you want, the default config for C++ is as below:
Jun HanJun HanThe build tasks are project specific. To create a new project, open a directory in Visual Studio Code.
Following the instructions here, press Ctrl + Shift + P, type Configure Tasks
, select it and press Enter.
The tasks.json file will be opened. Paste the following build script into the file, and save it:
Now go to menu File → Preferences → Keyboard Shortcuts, and add the following key binding for the build task:
Now when you press F8 the Makefile will be executed, and errors will be underlined in the editor.
BeeOnRopeA makefile task example for new 2.0.0 tasks.json version.
In the snippet below some comments I hope they will be useful.
attdonaattdonaOut of frustration at the lack of clear documentation,I've created a Mac project on github that should just work (both building and debugging):
Note that it requires XCode and the VSCode Microsoft cpptools extension.
I plan to do the same for Windows and linux (unless Microsoft write decent documentation first...).
Here is how I configured my VS for C++
Make sure to change appropriete paths to where your MinGW installed
launch.json
tasks.json
c_cpp_properties.json
Reference:
If your project has a CMake configuration it's pretty straight forward to setup VSCode, e.g. setup tasks.json
like below:
This assumes that there is a folder build
in the root of the workspace with a CMake configuration.
There's also a CMake integration extension that adds a 'CMake build' command to VScode.
PS! The problemMatcher
is setup for clang
-builds. To use GCC I believe you need to change fileLocation
to relative
, but I haven't tested this.
Here is how I configured my VS for C++ using g++ compiler and it works great including debugging options:
tasks.json file
launch.json file
I also have 'C/C++ for Visual Studio Code' extension installed in VS Code
Vlad BezdenVlad BezdenWith an updated VS Code you can do it in the following manner:
Hit (Ctrl+P) and type:
Open a folder (Ctrl+K & Ctrl+O) and create a new file inside the folder with the extension .cpp (ex: hello.cpp):
Type in your code and hit save.
Hit (Ctrl+Shift+P and type,
Configure task runner
and then selectother
at the bottom of the list.Create a batch file in the same folder with the name build.bat and include the following code to the body of the file:
Edit the task.json file as follows and save it:
Hit (Ctrl+Shift+B to run Build task. This will create the .obj and .exe files for the project.
For debugging the project, Hit F5 and select C++(Windows).
In launch.json file, edit the following line and save the file:
Hit F5.
Microsoft Visual Studio Code For Mac Won't Start Up
There's now a C/C++ language extension from Microsoft. You can install it by going to the 'quick open' thing (Ctrl+p) and typing:
You can read about it here:
It's very basic, as of May 2016.
You can reference to this latest gist having a version 2.0.0
task for Visual Studio Code, https://gist.github.com/akanshgulati/56b4d469523ec0acd9f6f59918a9e454
You can easily compile and run each file without updating the task. It's generic and also opens the terminal for input entries.
Peter MortensenDownload Visual Studio Code For Linux
Microsoft Visual Studio Code For Mac Won't Start In Safe
Akansh GulatiThe basic problem here is that building and linking a C++ program depends heavily on the build system in use. You will need to support the following distinct tasks, using some combination of plugins and custom code:
General C++ language support for the editor. This is usually done using ms-vscode.cpptools, which most people expect to also handle a lot of other stuff, like build support. Let me save you some time: it doesn't. However, you will probably want it anyway.
Build, clean, and rebuild tasks. This is where your choice of build system becomes a huge deal. You will find plugins for things like CMake and Autoconf (god help you), but if you're using something like Meson and Ninja, you are going to have to write some helper scripts, and configure a custom 'tasks.json' file to handle these. Microsoft has totally changed everything about that file over the last few versions, right down to what it is supposed to be called and the places (yes, placeS) it can go, to say nothing of completely changing the format. Worse, they've SORT OF kept backward compatibility, to be sure to use the 'version' key to specify which variant you want. See details here:
...but note conflicts with:
WARNING: IN ALL OF THE ANSWERS BELOW, ANYTHING THAT BEGINS WITH A 'VERSION' TAG BELOW 2.0.0 IS OBSOLETE.
Visual Studio Code For Chromebook
Here's the closest thing I've got at the moment. Note that I kick most of the heavy lifting off to scripts, this doesn't really give me any menu entries I can live with, and there isn't any good way to select between debug and release without just making another three explicit entries in here. With all that said, here is what I can tolerate as my .vscode/tasks.json file at the moment:
}
Note that, in theory, this file is supposed to work if you put it in the workspace root, so that you aren't stuck checking files in hidden directories (.vscode) into your revision control system. I have yet to see that actually work; test it, but if it fails, put it in .vscode. Either way, the IDE will bitch if it isn't there anyway. (Yes, at the moment, this means I have been forced to check .vscode into subversion, which I'm not happy about.) Note that my build scripts (not shown) simply create (or recreate) a DEBUG directory using, in my case, meson, and build inside it (using, in my case, ninja).
- Run, debug, attach, halt. These are another set of tasks, defined in 'launch.json'. Or at least they used to be. Microsoft has made such a hash of the documentation, I'm not even sure anymore.
To Build/run C++ projects in VS code , you manually need to configure tasks.json file which is in .vscode folder in workspace folder .To open tasks.json , press ctrl + shift + P , and type Configure tasks , and press enter, it will take you to tasks.json
Here i am providing my tasks.json file with some comments to make the file more understandable , It can be used as a reference for configuring tasks.json , i hope it will be useful
tasks.json
Now , stating directly from the VS code tasks documentation
description of type property :
- type: The task's type. For a custom task, this can either be shell or process. If shell is specified, the command is interpreted as a shell command (for example: bash, cmd, or PowerShell). If process is specified, the command is interpreted as a process to execute.
The behavior of the terminal can be controlled using thepresentation property in tasks.json . It offers the following properties:
reveal: Controls whether the Integrated Terminal panel is brought to front. Valid values are:
- always - The panel is always brought to front. This is the default
- never - The user must explicitly bring the terminal panel to the front using the View > Terminal command (Ctrl+`).
- silent - The terminal panel is brought to front only if the output is not scanned for errors and warnings.
focus: Controls whether the terminal is taking input focus or not. Default is false.
- echo: Controls whether the executed command is echoed in the terminal. Default is true.
- showReuseMessage: Controls whether to show the 'Terminal will be reused by tasks, press any key to close it' message.
- panel: Controls whether the terminal instance is shared between task runs. Possible values are:
- shared: The terminal is shared and the output of other task runs are added to the same terminal.
- dedicated: The terminal is dedicated to a specific task. If that task is executed again, the terminal is reused. However, the output of a different task is presented in a different terminal.
- new: Every execution of that task is using a new clean terminal.
- clear: Controls whether the terminal is cleared before this task is run. Default is false.
protected by Community♦May 22 '16 at 10:53
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Download Visual Studio Code For Windows
Microsoft’s Visual Studio has long been a heavyweight Windows-only development environment. But it has evolved over the years to support cross-platform, web, and mobile development, adding more and more features. For a giant, it moves fast, but it remains focused on building large-scale Windows applications for client PCs and for servers, whether on-premises or in the cloud.
That’s all very well for many developers, but there’s a substantial number of developers today using a new generation of programming editors to write web and microservices code. Tools like GitHub’s Atom epitomize this trend, along with MacOS-only tools that have spurred a shift that’s led to row after row of glowing Apple logos in the seats at technology conferences.
Visual Studio Code is the new standard for modern development
Microsoft’s response took some time, but the 2015 launch of Visual Studio Code, its first cross-platform development tool, quickly got rave reviews and, more important, a rapidly growing number of users—and not only on Windows.
Built using GitHub’s cross-platform Electron framework, Visual Studio Code is a full-featured development editor that supports a wide selection of languages and platforms, from the familiar C and C# to modern environments and languages like Go and Node.js, with parity between Windows, MacOS, and Linux releases.
Visual Studio Code quickly became a standard part of my personal device setup, replacing Notepad as my default text editor, and its now one of the first tools I install on a new PC. With its support for IntelliSense code highlighting, it’s also now my standard code viewer for web content, and it’s where I build and test JSON and JavaScript, for working with microservices and for configuring containers.
Visual Studio Code has even added support for a command-line terminal, including the Windows Linux Subsystem, so you can use it to build and test Unix apps without having to leave your PC. With Visual Studio Code and tools like Deis’s Draft you can download and install the Seneca microservices framework, write a Node.js app, wrap it in a Docker container, and deploy it to Azure without having to leave your editor.
Setting up Visual Studio Code
That’s Visual Studio Code’s main strength: bringing together all the tools you’re likely to need in a JavaScript-powered extensible framework, making it easy for third parties to quickly add their own extensions to the editor. Microsoft has an online marketplace that hosts plug-ins, adding language support, and providing links to continuous integration and source control services, as well as customizing Visual Studio Code’s UI with tweaks to support coding standards and test.
A free download, Visual Studio Code is one of those tools that crosses the boundaries between structured development environment and freeform text editor. If you add Markdown support, it’s where you write your documentation. With Git and other source control integration and debugging options, it’s also where you build, manage, and test your code. Getting set up is easy, and new features are added every month with an auto-update to the latest version. (There’s a nightly build option if you want to run development releases.)
The initial download is only the bare-bones: a basic editor with support for a handful of technologies: JavaScript, TypeScript, and Node.js. That’s enough for most basic web development, along with its code completion, management, and refactoring tools, and support for Git. (However, Microsoft does recommend that one of the first things you install is Node.js.) There’s also a terminal that to handle deployment and tests, without leaving your code. Usefully, Visual Studeo Code always reopens in the state it was in when you closed it, making it easy to pick up and carry on without losing too much focus.
Visual Studio Code’s look and feel is familiar from generations of IDEs, an explorer pane on the left exposes your current project, and a main pane hosts your open documents as tabs. Underneath that is a console panel that displays debugging information or hosts the built-in terminal. Projects can be as simple as a directory or as complex as .Net’s Visual Studio solution files, with support for other common project-packaging formats.
But the real advantage of Visual Studio Code is its extensibility. Want to use it develop in Go, C#, Python, or even Salesforce? All you need to do is download the appropriate extension and get to work. Other extensions offer additional debugging tools, improve code hinting, tidy up your source code formatting, or the look and feel of the editor. And if the feature you want isn’t there, there are plenty of documented APIs to help you add it yourself—and share it through the Visual Studio Code marketplace.
Unlike the full Visual Studio, which is almost an entire development tool chain, Visual Studio Code is designed to fit into existing development processes and already-running tool chains. It’s a smart move on Microsoft’s part, because downloading and installing Visual Studio Code won’t break team and project methodologies that have been in place for years. Developers can move to Visual Studio Code from other tools, yet still use the same back ends and testing environments, and they can work against the same repositories and directories.
Visual Studio Code and PowerShell: Like peanut butter and jelly
If you’re not already using Visual Studio Code, it’s time to download it and get started. For one thing, it’s soon to become Microsoft’s preferred development environment for PowerShell, using the official PowerShell extension. With PowerShell now a cross-platform management scripting engine, having an IDE that works across Windows, Linux, and MacOS makes a lot more sense than a Windows-only development tool.
Visual Studio Code’s built-in terminal console gives it a similar feel to the PowerShell ISE (integrated script environment) it’s replacing, with a single, integrated, interactive development environment that includes debugging and script-analysis tools. Using an open source tool makes sense now that PowerShell itself has moved to an open source model, as has the PowerShell extension on GitHub.
If you’re using the PowerShell ISE, you’ll continue to find it in Windows. But it won’t be getting any more investment and, as PowerShell moves on, it’ll be left behind. With a more responsive development approach at Microsoft and support for third-party tools in the Visual Studio Code marketplace, a shift to a new platform makes a lot of sense. For you diehards, Visual Studio Code’s customization tools should let you skin it to look like the PowerShell ISE you love.
Visual Studio Code stands up well against an explosion of other programming editors, and it fits in well with modern development tool chains. With an ever-growing library of extensions, it’s also easy to quickly find the tools you need for the languages you want to use, and to add the development features you find most useful. You can even add Emacs-compatible key-bindings!