Creating a C++ Development Environment
Clone this wiki locally
With the C++11 standard now widely supported, and the upcoming C++1y showing strong preliminary compiler support, the language is undergoing a bit of a renaissance. Unfortunately tools have not really kept up to date with the language evolution, although there are many positive signs.
This wiki contains notes on setting up a development environment for modern C++ development. The intent here is to share experience with tools that work well for me, and to solicit opinions on alternatives. I will try to keep these pages up to date with my experience. I will also try to keep it relevant to the specific challenges of C++ development, but occasionally I might recommend an unrelated but useful tool.
These pages are very much inspired by Alex Ott’s Gentle Introduction to CEDET, which is also highly recommended.
My environment is built around several key tools:
- GNU Emacs, currently version 24.1 (Why Emacs?)
- CEDET, including the Semantic parser library and EDE project management system
- Clang 3.4+, and sometimes GCC 4.8.2+
- CMake and Ninja
- Git, with Magit
I can deploy all of these tools on the different platforms I use at home and work, for a consistent experience. Furthermore I like to ensure that changes and tweaks I make can be rolled out easily, which is why I have all my .dotfiles in this repo.
Furthermore, I try to ensure that to the extent possible, the development environment is self-configuring. By this I mean it adapts to the specific needs of the platform or of the project on which I’m working. This might mean using a different compiler, or a different source layout, or formatting conventions etc. As long as some basic requirements are satisfied - mainly the use of CMake for project management - I am confident that my development environment will work with any given project on any of the platforms I use.
Because I tend to work on several different systems and platforms, I am biased towards tools that are either already packaged for that platform, or are easily deployed without many additional dependencies. Currently I have deployed to Ubuntu 13.10, Debian Jessie, CentOS 6.5 and Mac OS X 10.9.
In order to be productive as a developer you need to ensure that your development environment is tuned to your desired workflow. For me, this means I need to be open a file in any given project, then hit a key to build and run the associated unit tests. I also need to navigate the source files of the project easily, efficiently edit the code, launch a debugger, and many other crucial tasks that developers perform daily. The development environment needs to be optimized to perform these tasks quickly and easily.
In order to introduce my development environment, I’ll describe the workflows that are important to me, and how the various tools are configured to support these. I will generally omit unimportant details, so again I’d encourage you to refer to my dotfiles repo for the most current version.
- Environment Setup
- Project Setup
- Opening Projects
- Navigating Project Files
- Navigating Code
- Consulting Documentation
- Formatting Code
- Compilation Error Highlighting
- Coding Shortcuts
Other relevant resources: