MacOS: Xcode

If you have the disk space, Xcode IDE is by far the best option. It will provide you with a native and best experience. Setting up a C++ project is straightforward, the editor is great, and compiling and debugging is easy.  To get started, download Xcode via the macOS App Store, open Xcode, create new project, choose ‘Command Line Tool’, select ‘C++’ as the programming language, choose a name for your project, and save it to a disk location of your choice.

Create a new Xcode project.
Select the 'Command Line Tool' template.
Select 'C++' as your language and name your project.
Save your project to disk.

That’s it. You are now ready to start coding C++. The file ‘main.cpp’ has a ‘Hello, World!’ template. Simply press the play-button to compile and run the code. The output will appear in the console.

The interface of Xcode is very intuitive, clutter free, and easy to use. Additional files can be added by right-clicking on the folder in the navigation bar (left side bar), or by using the menu  ‘File’, ‘New’, ‘File’. Breakpoints can be set by a click of the mouse before the line number. This is enough for beginning programmers to get started. Helpful for editing is the ‘Code auto completion’ and ‘Syntax Highlighting’. 

Code autocompletion and syntax highlighting in action.

There are many alternatives, but none as easy to setup as Xcode. But it comes at a cost, the Xcode environment requires a whopping 15 GB of disk-space (it contains all the libraries to make full fledges MacOS, iOS, tvOS, and WatchOS apps, and includes emulators etc). For alternatives, the compilers (in the form of the command line tool utility) are required and this is about 1.3 GB. Other editors might be used that can be setup to make use of the Apple compilers.

Typical download and installation sizes of C++ IDE's on MacOS.
SoftwareDownload sizeUnpacked sizeDirectory
Xcode (12.3) Command Line Tools430.7 MB1.3 GB/Library/Developer/CommandLineTools/
Homebrew gcc 10.2-338.1MB/usr/local
Xcode (12.3) IDE10.8 GB15 GB/Applications/Xcode.app
Visual Studio Code (1.52.1)63.4 MB254 MB/Applications/Visual Studio Code.app
Qt Creator521 MB/Applications/Qt Creator.app
Netbeans379 MB831 MB/Applications/NetBeans
Code::Blocks142.4 MB451 MB/Applications/CodeBlocks.app
Eclipse370.4 MB442 MB/Applications/Eclipse.app

Visual Studio for Mac currently does not support building C++ out of the box. It has support for external building tools, but it will not be suitable as a proper IDE. With some work, the Visual Studio Code editor can be extended for C/C++ applications. Visual Studio Code is really more designed as a very flexible and extendible editor (very popular for web-design). For setting this up, see this link. QtCreator is a good cross-platform C++ development environment. Currently, Code::Blocks is not-available on recent MacOS versions. 

For experienced programmers, MacOS has all the command-line build utilities your would expect: make, cmake, configure, autoconf, automake, etc. With the recent Microsoft Windows Subsystem for Linux (WSL) this approach is now cross-platform. 

Windows: Visual Studio

Visual Studio is a full-featured integrated development environment for Android, iOS, Windows, web, and cloud. Download the Visual Studio installer and start the installation process. The Visual Studio Installer will help you install the tools, packages, and SDKs needed by your workload and component selections.

Visual Studio requires about 6.5 GB. The MSVC build tools and the Windows 10 SDK are required, other choices are optional.

When you open Visual Studio for the first time, you can optimize the development environment for the type of development that you do the most by choosing a collection of settings. Each collection optimizes elements such as keyboard shortcuts, window layouts, project and item templates, and command visibility. The following settings collections are available:

  • General
  • JavaScript
  • Visual Basic
  • Visual C#
  • Visual C++
  • Web Development
  • Web Development (Code Only)

The default color theme for Visual Studio’s user interface is called Blue. You can change it to Dark or Light.

Any individual developer can use Visual Studio Community to create their own free or paid apps. In addition, any number of users may use the software to develop and test device drivers for the Windows operating system. If your Community edition installation prompts you for a license, sign in to the IDE to continue using Visual Studio Community for free. If you don’t have a Microsoft account, you can create a Microsoft account for free by clicking the link under the sign in button. 

Visual Studio uses projects to organize the code for an app, and solutions to organize your projects. A project contains all the options, configurations, and rules used to build your apps. It also manages the relationship between all the project’s files and any external files. To create your app, first, you’ll create a new project and solution.

The usual starting point for a C++ programmer is a “Hello, world!” application that runs on the command line. Visual Studio uses projects to organize the code for an app, and solutions to organize your projects. A project contains all the options, configurations, and rules used to build your apps. It also manages the relationship between all the project’s files and any external files. To create your app, first, you’ll create a new project and solution.

An empty C++ Windows console application gets created. In Visual Studio, an editor window opens and shows the generated code..

The template for a new Windows console application creates a simple C++ “Hello World” app. At this point, you can see how Visual Studio builds and runs the apps you create right from the IDE. To build your project, choose Build Solution from the Build menu. Console applications use a Windows console window to display output and accept user input. 

Typical download and installation sizes on Windows.
SoftwareDownload sizeUnpacked sizeDirectory
Visual Studio (16.8.4) IDE-6.51 GBC:\Program Files (x86)\Microsoft Visual Studio\
Visual Studio Code (1.52.1)61.9 MB247 MBC:\Program Files\Microsoft VS Code\
MSYS293.5 MB375 MB - 1.91 GBC:\msys64

MSYS2 is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top