Blog Post

Best C++ IDEs of 2024

Illustration: Best C++ IDEs of 2024
Information

This article was first published in May 2020 and was updated in July 2024.

PSPDFKit has a large C++ codebase. Our developers write, debug, and commit C++ code to the PSPDFKit repository every day, and we use a variety of IDEs and text editors in the process.

The PSPDFKit codebase isn’t tied to any particular IDE, which means our developers are free to use their IDE or text editor of choice. Because of this freedom, and also because we develop C++ for many different platforms — including Linux, macOS, and Windows — the number of tools we use to write C++ code is significant.

This blog post will summarize what we consider to be the most interesting C++ IDEs and text editors as of 2024. We’ll also share their pros and cons based on the experience we have using them.

IDEs for C++ Development

The first big group of development tools is that of integrated development environments, or IDEs. These are programs that include many different things required during development, such as a text editor, an integrated debugger, and different code assistance features that make browsing a big codebase an easier task. Within this group of tools, we want to highlight JetBrains’ CLion (multiplatform), Xcode (macOS), and Visual Studio (Windows).

CLion

CLion is a C++ IDE developed by JetBrains. It’s written primarily in Java, and it’s based on JetBrains’ own IDE infrastructure that’s shared among other popular Java products, including IntelliJ IDEA, PyCharm, and WebStorm. CLion’s support for CMake projects is very good, so you usually don’t need to spend a lot of time getting a CMake-based project working.

CLion provides many different code assistance features that give users the ability to complete code, go to the definition of any symbol, search for code references, and navigate class hierarchies. These features are important in a large C++ codebase like the PSPDFKit one, because developers are usually not completely familiar with the part of code they’re working on, and being able to navigate the code in a variety of ways helps them understand it more quickly.

CLion also integrates well with some linting tools we use, including clang-tidy and clang-format. To ensure this works seamlessly, we configure CLion to always use a specific version of clang-tidy and clang-format and not what it comes bundled with, because it’s important that every developer on the team lints and formats the codebase in the same way.

However, one of the problems we’ve encountered with CLion pertains to performance: The time it takes to completely index an entire project can be very long, especially if the code has a high number of C++ templates. This is because parsing C++ templates is a complex problem. Additionally, in some cases, the IDE may not be very responsive while indexing.

That said, we’ve found two things that help mitigate this issue: increasing the amount of heap memory dedicated to CLion’s Java VM, and trying to only import the subproject that’s actively being worked on. This page on performance tuning provides some helpful tips. JetBrains continually invests a lot of resources into improving CLion’s performance, so it’s important to always check for the latest version.

Xcode

Some Xcode code intelligence features for C++ code

Xcode is a C++ IDE developed by Apple. We use Xcode because it’s tightly integrated with other languages we use in our PSPDFKit for iOS product: Objective C, Objective C++, and Swift. The integrated debugger (LLDB) is also easy to set up and use.

Here’s an article where we describe how we extended LLDB to work better for our C++ codebase. We don’t think indexing a large-scale C++ project in Xcode is particularly slow, and the IDE remains functional while the project is indexing. We have spent some time improving how Xcode indexes our project because we think it’s good for developer productivity. Meanwhile, in this article, we describe how Xcode indexing works and how you can make it work better for your project.

The main disadvantage we see in Xcode compared to other IDEs is that the code assistance features are not as powerful. For example, Xcode provides good support for jumping to a definition and calling references, but the only refactoring that is supported out of the box is symbol renaming.

Another downside to Xcode is it’s not as extensible as other IDEs, and that complicates the integration of code formatting and linting tools. We have been able to create some extensions for linting our documentation and formatting our code that we share with the iOS team, but overall, we think the set of things in Xcode that can officially be extended is still limited.

Finally, starting with Xcode 13, you can enable emulate Vim keybindings from the Editor menu, Vim Mode.

Visual Studio

Visual Studio is probably the most used C++ IDE in the world, especially among game developers. It’s currently the second most popular IDE in Stack Overflow’s most recent developer survey. Our team mainly uses Visual Studio when developing PSPDFKit for Windows and many of our ORPALIS products. We like that Visual Studio supports the languages we use to develop these products; along with C++, we also use C# and JavaScript. Another plus about Visual Studio is that debugging for C++, C#, and JavaScript is integrated. We find it’s useful to debug multiple languages in the same session, because our Windows product has layers implemented in different languages.

Visual Studio also supports a rich set of extensions. One example of this is ReSharper, which improves the C# code assistance provided by Visual Studio with interesting refactorings, like the ability to extract interfaces and move up member functions. For C++, we especially like Visual Studio’s build analysis tools, which help us discover and fix subtle problems that slow down our builds, such as an excessive number of header #includes.

Although Visual Studio’s support for C++ is good, we usually need to complement it with third-party extensions like Visual Assist to match other IDEs. Additionally, although we think Visual Studio’s integrated debugger is powerful and easy to use, we’ve had some problems when trying to debug multiple languages in the same session. That said, we think no vendor has completely solved the problem of debugging code in multiple programming languages yet.

Qt Creator

Qt Creator is a C++ IDE that works even if you don’t use the Qt cross-platform software development framework. It’s a powerful IDE that integrates well with existing C++ compilers and debuggers, and it’s fast. We think Qt Creator is worth a try if you’re already familiar with Xcode but you’d like to have additional features that are missing in Xcode, like CMake support, clang-format integration, or some refactoring actions. Qt Creator is also a good option for developers who use CLion but, for some reason, aren’t happy with its performance.

Eclipse

Eclipse is an IDE with support for multiple languages, including Java and C++. Eclipse CDT is the name of the plugin that adds support for C++ to Eclipse. Even though Eclipse is still used by many universities teaching C++ to students, we feel like Eclipse’s C++ community isn’t very big right now, so its support for the latest C++ standards and frameworks may be lacking a bit, compared to Visual Studio or CLion. Eclipse may feel more lightweight than those more modern IDEs, though.

Text Editors for C++ Development

Some people at PSPDFKit prefer to use a simple text editor to develop in C++. Thanks to the Language Server Protocol (LSP), the line between a text editor and an IDE has been blurred, and many text editors support advanced features such as code completion and name refactoring.

The main C++ text editor that supports LSP is Visual Studio Code, although the protocol is also implemented by less popular text editors like Vim, Sublime Text, Atom, and Emacs. Some benefits we see in using text editors to develop in C++ is that they tend to be faster, they’re available for multiple platforms, and they’re usually free and open source.

The next section will briefly cover how LSP works with C++ (with Visual Studio Code as its “gold standard” implementation).

Visual Studio Code and the Language Server Protocol (LSP)

Visual Studio Code offering autocomplete options for a piece of C++ code

Visual Studio Code is a powerful text editor created and released by Microsoft in 2015. There are many extensions available for C++ development, including an official extension from Microsoft, the ccls extension, and the clangd extension. These extensions implement LSP, which is a protocol designed by Microsoft to decouple text editors from code assistance features.

Our team prefers the ccls and clangd extensions, as they seem to receive more regular updates and improvements. For example, you can see the range of code assistance features that clangd supports here. For integrated C++ debugging, Visual Studio Code also supports several extensions. We have written a more detailed post about our experience working with Visual Studio Code in the PSPDFKit codebase.

Other C++ Text Editors

Thanks to LSP, many other C++ text editors have gained “IDE-like” capabilities without being proper IDEs. Neovim has supported LSP natively since this PR, there’s a popular extension for Atom, and Sublime Text also has support for LSP. There are also newer C++ text editors that support LSP out of the box, like Zed.

The main disadvantage of LSP-based C++ editors is that, even though a lot of code assistance features are supported, things like refactoring are still not as complete as they are in full-featured IDEs. Another disadvantage is that adding LSP support to C++ text editors usually requires a non-trivial amount of configuration.

Tree-sitter

Tree-sitter is a parser generator and incremental parsing library that can be integrated in C++ text editors as well. Text editors commonly use Tree-sitter to provide accurate syntax highlighting and advanced movement or replacement commands, like “select class,” “replace function,” etc. This is especially important for C++ because the latest versions of the C++ standard (like C++23) introduce new syntax and keywords that regular text editors may not support. The Tree-sitter C++ library is maintained by a good amount of contributors as of 2024.

How to Run a C++ Program in a Text Editor?

The final question is, if you decide to use a C++ text editor, how can you run a C++ program with it? Text editors, unlike IDEs, don’t usually provide a simple way to compile and debug programs. However, advanced text editors like Visual Studio Code blur the line between a basic text editor and an IDE and provide some support for building and running C++ programs. Follow this guide to configure Visual Studio code for running and debugging C++ programs.

Conclusion

In this blog post, we explored different IDEs and text editors that can be used to write C++ and shared the pros and cons of using them.

We don’t see a tool that is a clear winner for C++ development. However, we’re pleased to see there’s recently been a lot of innovation regarding C++ tooling, so it’s safe to say it’s the best possible time to develop in C++, as there are more options than ever.

That said, we also have some criticism; for example, we don’t think C++ tooling is at the same level as tooling for other languages is (Java being a prime example). However, we’re always interested in opportunities where PSPDFKit could contribute to help make the C++ ecosystem better.

Our main recommendation is that your organization does not tie projects to any particular text editor or IDE, and that the company fosters a culture of maintaining a set of small project-specific extensions for developers who use a particular IDE. If developers are free to use the environment they’re more familiar with, they’ll be happier, they’ll probably stay at your company longer, and they’ll ultimately be more productive.

Author
Daniel Martín Core Engineer

Daniel is part of the Core Team at Nutrient and has worked on multiple topics, ranging from cryptography and text systems, to file format support and JavaScript engines. Outside of work, he likes spending time with his family, football, reading books, and watching films.

Share post
Free trial Ready to get started?
Free trial