Visual Studio Code for C++ development on MacOS

I’ve tried lot’s of c++ IDEs on MacOS X, but none of them is as powerful as VS Studio on Windows. It’s always hard for me to choose an IDE before I want to write some code, as it’s called the Selection phobia. Generally we have the following choose:

Recently I tried Visual Studio Code, it’s really a good choose for those who want to write some c++ code in a lightweight IDE.

Setup Visual Studio Code for C++ development

First we have to install Visual Studio Code, and a few extensions:

After installed those extensions, reload the editor to activate them. Now we can create a project:

After the above steps a new project with Makefile is generated.

Common usage

To debug or run the project, just click the button on the bottom status bar, it’s easy:

Figure 1: visual code studio snapshot
visual code studio snapshot

to run other commands, you could just press F1 and guess, for example, to format the code, just search “format” and then you got a choice.

Update: How to setup eclipse CDT in MacOX

Recently I tried to use eclipse-cdt with cmake build system, there are a few tips:

In order to debug, basiclly eclipse only supports gdb, which is has been replaced with lldb in MacOS, so a few setps needed to make it working:

Reference: