in ,

C ++ Ecosystem: Compilers, IDEs, Tools, Testing and More, Hacker News

C ++ Ecosystem: Compilers, IDEs, Tools, Testing and More, Hacker News


C   Ecosystem

To write a professional C application, you not only need a basic text editor and a compiler. You require some more tooling. In this blog post, you’ll see a broad list of tools that make C programming possible: compilers, IDEs, debuggers and other.

Note:This is a guest post based on the White Paper created by Embarcadero, see the full paper here:C Ecosystem White Paper.

Introduction

The C computer programming language has become one of the most widely used modern programming languages. Software built with C is known for its performance and efficiency. C has been used to build numerous vastly popular core libraries, applications such as Microsoft Office, game engines such as Unreal, software tools like Adobe Photoshop, compilers like Clang, databases like MySQL, and even operating systems such as Windows across a wide variety of platforms as it continues to evolve and grow.

Modern C is generally defined as C code that utilizes language features in C 11, C 14, and C 17 based compilers. These are language standards named after the year they were defined (2011, 2014 and 2017 respectively) and include a number of significant additions and enhancements to the original core language for powerful, highly performant, and bug-free code. Modern C has high-level features that support object-oriented programming, functional programming, generic programming, and low-level memory manipulation features.

Big names in the computer industry such as Microsoft, Intel, the Free Software Foundation, and others have their modern C compilers. Companies such as Microsoft, The QT Company, JetBrains, and Embarcadero provide integrated development environments for writing code in modern C . Popular libraries are available for C across a wide range of computer disciplines including Artificial Intelligence, Machine Learning, Robotics, Math, Scientific Computing, Audio Processing, and Image Processing.

In this blog post, we are going to cover a number of these compilers, build tools, IDEs, libraries, frameworks, coding assistants, and much more that can support and enhance your development with modern C .

Let’s get started!

There are a number of popular compilers that support modern C including GCC / g , MSVC (Microsoft Visual C ), and Clang. Each compiler has varying support for each of the major operating systems with the open-source GCC / g originating in the late 1980 s, Microsoft’s Visual C in the early 1990 s, and Clang in the late 2000 s. All three compilers support modern C up to at least C 17, but the source code licenses for each of them vary greatly.

GCC

GCC is a general-use compiler developed and maintained and regularly updated by the GCC Steering committee as part of the GNU Project. GCC describes a large growing family of compilers targeting many hardware platforms and several languages. While it mainly targets Unix-like platforms, Windows support is provided through the Cygwin or MinGW runtime libraries. GCC compiles modern C code up to C 17 with experimental support for some C 20 features. It also compiles with a variety of language extensions that build upon C standards. It is free and open-source (GPL3) with the GCC Runtime Library Exception. GCC has support from build tools such as CMake and Ninja and many IDEs such as CLion, Qt Creator, and Visual Studio Code.
https://gcc.gnu.org/
https://gcc.gnu.org/projects/cxx-status.html

Microsoft Visual C

Microsoft Visual C (MSVC) is Microsoft’s compiler for their custom implementation of the C standard, known as Visual C . It is regularly updated, and like GCC and Clang, supports modern C standards up to C 17 with experimental support for some C 20 features . MSVC is the main method for building C applications in Microsoft’s own Visual Studio. It generally targets a number of architectures on Windows, Android, iOS, and Linux. Support for build tools and IDEs are limited but growing. CMake extensions are available in Visual Studio 2019. MSVC can be used with Visual Studio Code, with limited support from CLion and Qt Creator with additional extensions. MSVC is proprietary and available under a commercial license, but there’s also a Community edition.
https://en.wikipedia.org/wiki/Microsoft_Visual_C++
https://devblogs.microsoft.com/ visualstudio /
https://visualstudio.microsoft.com/vs/community/

Clang

Clang describes a large family of compilers for the C family of languages ​​maintained and regularly developed as part of the LLVM project. Although it targets many popular architectures, it generally targets fewer platforms than GCC. The LLVM project defines Clang through key design principles – strict adherence to C standards (although support for GCC extensions is offered), modular design, and minimal modification to the source code’s structure during compilation, to name a few. Like GCC, Clang compiles modern C code with support for the C 17 standard with experimental C 20 Support. It is available under an open-source (Apache License Version 2.0) license. Clang also has widespread support from build tools such as CMake and Ninja and IDEs such as CLion, Qt Creator, Xcode, and others.
https://clang.llvm.org/
https://clang.llvm.org /cxx_status.html

Make

Make is a well-known build system widely used, especially in Unix and Unix-like operating systems. Make is typically used to build executable programs and libraries from source code. But the tool is applicable to any process that involves executing arbitrary commands to transform a source file to a target result. Make is not tight to any particular programming language. It automatically determines which source files has been changed and then performs the minimal build process to get the final output. It also helps with the installation of the results in the system
https://www.gnu.org/software/make/

Cmake

CMake is a cross-platform tool for managing your build process. Building, especially large apps and with dependent libraries, can be a very complex process, especially when you support multiple compilers; CMake abstracts this. You can define complex build processes in one common language and convert them to native build directives for any number of supported compilers, IDEs, and build tools, including Ninja (below.) There are versions of CMake available for Windows, macOS, and Linux.
https://cmake.org/

Note:Here’s a good answer about the differences between Make and Cmake:Difference between using Makefile and CMake to compile the code – Stack Overflow.

Ninja

The Ninja build system is used for the actual process of building apps and is similar to Make (a traditional but now less used utility.) It focuses on running as fast as possible by parallelizing builds. It is commonly used paired with CMake, which supports creating build files for the Ninja build system. The feature set of Ninja is intentionally kept minimal because the focus is on speed.
https://ninja-build.org/

Microsoft Build Engine (MSBuild)

MSBuild is a command-line based built platform available from Microsoft under an open-source (MIT) license. It can be used to automate the process of compiling and deploying projects. It is available stand-alone, packaged with Visual Studio, or from Github. The structure and function of MSBuild files is very similar to Make. MSBuild has an XML based file format and mainly has support for Windows but also macOS and Linux. IDEs such as CLion and C Builder can integrate with MSBuild as well.
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild

Conan, Vcpkg, Buckaroo

Package managers such as Conan, vcpkg, and Buckaroo have been gaining popularity in the C community. A package manager is a tool to install libraries or components.

Conan is a decentralized open-source (MIT) package manager that supports multiple platforms and all build systems (such as CMake and MSBuild). Conan supports binaries with a goal of automating dependency management to save time in development and continuous integration.

Microsoft’s vcpkg is open source under an MIT license and supports Windows, macOS, and Linux (and even integrates with CMake). Vcpkr requires Visual Studio 2015 or newer, so it is somewhat limited in scope.

Buckaroo is a lesser-known open-source package manager that can pull dependencies from GitHub, BitBucket, GitLab, and others. Buckaroo offers integrations for a number of IDEs including CLion, Visual Studio Code, XCode, and others.

Here are the links for the mentioned package managers:

************************************** (Compiler Explorer & Online Tools)

Compiler Explorer is a web-based tool that allows you to select from a wide variety of C compilers and different versions of the same compiler to test out your code. This allows developers to compare the generated code for specific C constructs among compilers, and test for correct behavior. Clang, GCC, and MSVC are all there but also lesser-known compilers such as DJGPP, ELLCC, Intel C , and others.
https://godbolt.org/

Extra: Here’s a list of handy online compilers that you can use: like Coliru, Wandbox, CppInsighs and more:https: // arnemertz .github.io / online-compilers /

Integrated Development Environments

A host of editors and integrated development environments (IDEs) can be used for developing with modern C . Text editors are typically lightweight, but are less featureful than a full IDE and so are used only for the process of writing code, not debugging or testing it. Full development requires other tools, and an IDE contains those and integrates into a cohesive, integrated development environment. Any number of text editors like Sublime Text, Atom, Visual Studio Code, vi / vim, and Emacs can be used for writing C code. However, some IDEs are specifically designed with modern C in mind like CLion, Qt Creator, and C Builder, while IDEs like Xcode and Visual Studio also support other languages.

Sublime Text, Atom, And Visual Studio Code

  • Sublime Text is a commercial text editor with extended support for modern C available via plugins.
  • Atom is an open-source (MIT license) text editor that supports modern C via packages with integrations available for debugging and compiling.
  • Visual Studio Code is a popular open-source (MIT license) source-code editor from Microsoft.

A wide variety of extensions are available that bring features such as debugging and code completion for modern C to Visual Studio Code. Sublime Text, Atom, and Visual Studio Code are all available for Windows, macOS, and Linux.

Here are the links for the above tools:

Vi / Vim & Emacs

Vi / Vim and Emacs are free command-line based text editors that are mainly used on Linux but are also available for macOS and Windows. Modern C support can be added to Vi / Vim through the use of scripts while modern C support can be added to Emacs through the use of modules.
(https://www.vim.org/)
https: / /www.gnu.org/software/emacs/

Clion

CLion is a commercial IDE from JetBrains that supports modern C . It can be used with build tools like CMake and Gradle, integrates with the GDB and LLDB debuggers, can be used with version control systems like Git, test libraries like Boost.Test, and various documentation tools. It has features such as code generation, refactoring, on the fly code analysis, symbol navigation, and more.
https: //www.jetbrains. com / clion /

Qt Creator

Qt Creator is a free an open-source IDE from The Qt Company which supports Windows, macOS, and Linux. Qt Creator has features such as a UI designer, syntax highlighting, auto-completion, and integration with a number of different modern C compilers like GCC and CLang. Qt Creator tightly integrates with the Qt library for rapidly building cross-platform applications. Additionally, it integrates with standard version control systems like Git, debuggers like GDB and LLDB, build systems like CMake, and can deploy cross-platform to iOS and Android devices.
https: // www. qt.io/

C Builder

C Builder is a commercial IDE from Embarcadero Technologies which runs on Windows and supports modern C . It features the award-winning Visual Component Library (VCL) for Windows development and FireMonkey (FMX) for cross-platform development for Windows, iOS and Android. The C Builder compiler features an enhanced version of Clang, an integrated debugger, visual UI designer, database library, comprehensive RTL, and standard features like syntax highlighting, code completion, and refactoring. C Builder has integrations for CMake, can be used with Ninja, and also MSBuild.
https: // www.embarcadero.com/products/cbuilder
https://www.embarcadero.com/products/cbuilder/starter

Visual Studio

Visual C is a commercial Visual Studio IDE from Microsoft. Visual Studio integrates building, debugging, and testing within the IDE. It provides the Microsoft Foundation Class (MFC) library which gives access to the Win 32 APIs. Visual Studio features a visual UI designer for certain platforms, comes with MSBuild, supports CMake, and provides standard features such as code completion, refactoring, and syntax highlighting. Additionally, Visual Studio supports a number of other programming languages, and the C side of it is focused on Windows, with other platforms slowly being added.
https : //visualstudio.microsoft.com/

Xcode

Xcode is a multi-language IDE from Apple available only on macOS that supports modern C . Xcode is proprietary but available for free from Apple. Xcode has an integrated debugger, supports version control systems like Git, features a Clang compiler, and utilises libc as its standard library. It supports standard features such as syntax highlighting, code completion, and refactoring. Additionally, Xcode supports external build systems like CMake and utilises the LLDB debugger.
https://developer.apple.com/xcode/

Debugging & Testing

GDB

GDB is a portable command-line based debugging platform that supports modern C and is available under an open-source license (GPL). A number of editors and IDEs like Visual Studio, Qt Creator, and CLion support integration with GDB. It can also be used to debug applications remotely where GDB is running on one device, and the application being debugged is running on another device. It supports a number of platforms including Windows, macOS, and Linux.
https://www.gnu.org/software/gdb/

LLDB

LLDB is an open-source debugging interface that supports modern C and integrates with the Clang compiler. It has a number of optional performance-enhancing features such as JIT but also supports debugging memory, multiple threads, and machine code analysis. It is built in C . LLDB is the default debugger for Xcode and can be used with Visual Studio Code, CLion, and Qt Creator. It supports a number of platforms including Windows, macOS, and Linux.
https://lldb.llvm.org/

CATCH / CATCH2

Catch2 is a cross-platform open-source (BSL-1.0) testing framework for modern C . It is very lightweight because only a header file needs to be included. Unit tests can be tagged and run in groups. It supports both test-driven development and behavior-driven development. Catch2 also easily integrates with CLion.
https://github.com/catchorg/Catch2

BOOST.TEST

Boost.Test is a feature-rich open-source (BSL-1.0) testing framework that utilises modern C standards. It can be used to quickly detect errors, failures, and time outs through customizable logging and real-time monitoring. Tests can be grouped into suites, and the framework supports both small scale testing and large scale testing.
https://github.com/boostorg/test

GOOGLE TEST

Google Test is Google’s C testing and mocking framework, which is available under an open-source (BSD) license. Google test can be used on a broad range of platforms, including Linux, macOS, Windows, and others. It contains a unit testing framework, assertions, death tests, detects failures, handles parameterized tests, and creates XML test reports.
https://github.com/google/googletest

CUTE

CUTE is a unit testing framework integrated in Cevelop, but it can also be used stand-alone. It spans C versions from c 98 to c 2a and is header-only. While not as popular as Google Test it is less macro-ridden and uses macros only, where no appropriate C feature is available. In addition, it features a mode that easily allows it to run on embedded platforms, by sidestepping some of the I / O formatting features.
https://cute-test.com/

Clang Sanitizers

Sanitisers are tools that add extra instrumentation to your application (for example they replace new / malloc / delete calls) and can detect various runtime errors: leaks, use after delete, double free and many others. To improve your build pipeline, many guides advice to add sanitisers steps when doing tests.

Summary & More

I hope that with the above list, you get a useful overview of the tools that are essential for C development.

If you want to read more about other ecosystem elements: libraries, frameworks, and other tools, then please see the full report from Embarcadero:
C Ecosystem White Paper
(It’s a nice looking pdf, with more than 20 pages of content!)

You might check this Resource for a super long list of tools, libs, frameworks that enhance C development:
https: // github .com / fffaraz / awesome-cpp

Your Turn

What are your favorite tools that you use when writing C apps?

Brave Browser
Read More
Payeer

What do you think?

Leave a Reply

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

GIPHY App Key not set. Please check settings

Epic Games CEO Tim Sweeney Really Shouldn’t Be Allowed on Twitter, Crypto Coins News

Epic Games CEO Tim Sweeney Really Shouldn’t Be Allowed on Twitter, Crypto Coins News

Doom Eternal joins this year’s game-delay club, will launch March 2020, Ars Technica

Doom Eternal joins this year’s game-delay club, will launch March 2020, Ars Technica