Find Your Favorite Library for C++ in NuGet
Many of you may know that NuGet is the “go-to” library repository for .NET development, but what about using it for C++? The answer here may surprise you as many of the top open source C++ libraries are actually sitting in the NuGet gallery.
For those who haven’t used NuGet before, NuGet is the package manager system for the Microsoft development platform. Adding library packages from the NuGet gallery to your Visual Studio project is as easy as clicking one installation button. The gallery started with .NET libraries and now we are working on getting more C++ libraries into its ecosystem.
Let’s take a look at what is already available in the NuGet gallery for C++ developers.
Complete Boost package with satellites binary packages. For Visual C++ 2013 / 2012 / 2010
The package is a helper for setting up a C++ project to use wxWidgets.
Windows Template Library (WTL) is a C++ library for developing Windows applications and UI components
One of the most popular open-source graphics rendering engines.
It is a collection of helper classes for writing DirectX 11.x code in C++.
The Free openGL Utility Toolkit, is meant to be a free alternative to Mark Kilgard’s GLUT library.
GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform.
GLFW is an Open Source, multi-platform library for creating windows with OpenGL contexts and managing input and events.
Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.
OpenCV (Open Source Computer Vision) is a library of programming functions for realtime computer vision.
Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.
SFML provides a simple interface to the various components of your PC, to ease the development of games and multimedia applications. There are five packages for five modules: system, window, graphics, audio and network.
The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromium-based browsers in other applications.
The implementation of Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS) protocols as well as a full-strength general purpose cryptography library.
Libssh2 is a client-side C library implementing the SSH2 protocol.
Modern, powerful open source C++ class libraries and frameworks for building network- and internet-based applications that run on desktop, server, mobile and embedded systems. 1.4.6 is a maintenance version. Multiple packages are included.
A cross-platform library supports cloud-based client-server communication in native code using a modern asynchronous C++ API design.
This client library enables working with the Microsoft Azure storage services which include the blob service for storing binary and text data, the table service for storing structured non-relational data, and the queue service for storing messages that may be accessed by a client.
Curl is a tool and libcurl is a library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP. With many features.
SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
SOCI provides C++ programmers a way to access multiple SQL databases in the most natural and intuitive way.
A massively spiffy yet delicately unobtrusive compression library.
Libxml2 is the XML C parser and toolkit available for multiple languages and platforms.
TinyXML-2 is a simple, small, efficient, C++ XML parser that can be easily integrating into other programs.
A C++ library for interacting with JSON.
A library for writing multithreaded applications with POSIX threads. This is a Win32 package.
This package contains C software to implement JPEG image encoding, decoding, and transcoding.
libpng is the official PNG reference library.
See something familiar and want to try it out? Go for it, but remember, for most of them to work, you may need Visual Studio 2013 (or express version). Don’t feel bad if your favorite library is not on the list as we only listed a small portion of the C++ packages. More native libraries can be found in the gallery, and please do comment after the blog if you think some important C++ library is missing from the gallery or some package on the list doesn’t work for you.
NuGet for C++
Installing a C++ package from NuGet is not that different from .NET. Packages can either be installed through the NuGet console by typing “Install-Package [package name]” if you know the package name or they can be found and installed by using “Manage NuGet Package” window (Figure 2), which can be opened from your project context menu (Figure 1).
All the project dependencies, include paths and lib paths will be added automatically into your vcxproj. In rare cases, you may need to manually copy DLLs to your binary folder to run your program for some packages.
Notably, NuGet for C++ still has some limitations. You may find difficulties distinguishing C++ packages from .NET packages in the search results. Adding a tag filter “tags:native” to your search box could give you more accurate results. Another thing you need to be aware of is the package compatibility. Most NuGet packages target a specific version of Visual Studio; not every package supports all processor architectures.
We Are Listening
We want the NuGet package system to bring the best library distribution experience for C++ on Windows. Your feedback is critical as we consider adding more C++ packages and features to NuGet.