# Introducing the new C++ plugins

DevFeed: [Introducing the new C++ plugins](<https://devfeed.tech/articles/introducing-the-new-c-plugins-24656.md>)

Original publisher: [Read original article](<https://blog.gradle.org/introducing-the-new-cpp-plugins>)

Author: Adam Murdoch

Published: 2018-01-10T05:00:00Z

Content type: tutorial

Language: en

Sources: [The Gradle Blog](<https://devfeed.tech/sources/the-gradle-blog.md>)

Topics: [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Dependency management](<https://devfeed.tech/topics/dependency-management.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [macOS](<https://devfeed.tech/topics/macos.md>), [Xcode](<https://devfeed.tech/topics/xcode.md>), [Windows](<https://devfeed.tech/topics/windows.md>)

Tags: [applications](<https://devfeed.tech/tags/applications.md>), [build](<https://devfeed.tech/tags/build.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [clang](<https://devfeed.tech/tags/clang.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [dependency-management](<https://devfeed.tech/tags/dependency-management.md>), [gcc](<https://devfeed.tech/tags/gcc.md>), [github](<https://devfeed.tech/tags/github.md>), [library](<https://devfeed.tech/tags/library.md>), [linux](<https://devfeed.tech/tags/linux.md>), [macos](<https://devfeed.tech/tags/macos.md>), [visual-studio](<https://devfeed.tech/tags/visual-studio.md>), [windows](<https://devfeed.tech/tags/windows.md>), [xcode](<https://devfeed.tech/tags/xcode.md>)

## AI overview

This post introduces Gradle's new C++ plugins for building libraries and applications on macOS, Linux, and Windows with GCC, Clang, and Visual C++/Visual Studio. It demonstrates application builds, compiler and linker discovery, Xcode workspace generation, and dependency management through Maven repositories.

## Source excerpt

This post introduces some new plugins for C++ that we've been working on. These plugins can build C++ libraries and applications. They work on macOS, Linux, and Windows with GCC, Clang and Visual C++/Visual Studio. The plugins will eventually replace the software model plugins and take advantage of many new features baked into Gradle core, such as a rich dependency management engine, build cache, composite builds, finer grained parallel execution, build scans, and more. For background, see our post on the State and Future of the Gradle Software Model. We welcome any feedback you may have about these plugins. You can leave feedback on the Gradle forums or raise issues on the Gradle native GitHub repository. Building an application You can find all of the samples from this post in the Gradle native samples GitHub repository. Let's look at building a simple application. The build script should look familiar to anyone who has used Gradle's Java plugins: plugins { id 'cpp-application' } This application has no dependencies, and the C++ source files and headers live in the default location: the src/main/cpp directory. Since this is Gradle, you can easily configure the source locations to match whatever layout your project has, including the common pattern of putting everything in one directory. Here's the result of running ./gradlew assemble on this sample: Take a look at the build scan for this build to see what happened in more detail. The plugins automatically find the compiler, linker and other tools to build the application. The result ends up installed in the build/install directory ready to run. IDE support Xcode is currently supported for C++ projects. You can just run ./gradlew xcode and open the generated workspace. Support for generating Visual Studio solutions will be added early this year and support for other IDEs will be gradually added after that. Here is the result of running ./gradlew xcode on the sample: This is how the workspace looks in Xcode: Depende