Find Your Favorite Library for C++ in NuGet

February 13th, 2015

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.

Category Name Version (NuGet/Latest) Details General Purpose Boost 1.57/1.57 Complete Boost package with satellites binary packages. For Visual C++ 2013 / 2012 / 2010

GUI wxWidgets

Helper 2.4.2/2.4.2 The package is a helper for setting up a C++ project to use wxWidgets. WTL 9.0/9.0 Windows Template Library (WTL) is a C++ library for developing Windows applications and UI components Graphics Ogre3D 1.83/1.90 One of the most popular open-source graphics rendering engines. DirectX

Toolkit 2015.1/2015.1 It is a collection of helper classes for writing DirectX 11.x code in C++. Freeglut 2.8.1/2.8.1 The Free openGL Utility Toolkit, is meant to be a free alternative to Mark Kilgard’s GLUT library. Glew 1.9.0/1.12.0 GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform. Glfw 3.0/3.4 GLFW is an Open Source, multi-platform library for creating windows with OpenGL contexts and managing input and events. Scientific Eigen 3.2.3/3.2.4 Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. OpenCV 2.4.9/2.4.10 OpenCV (Open Source Computer Vision) is a library of programming functions for realtime computer vision. Multi-Media SDL 2.0.3/2.0.3 Simple DirectMedia Layer, a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms. SFML 2.2/2.2 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. CEF 3.2171/3.2171 The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromium-based browsers in other applications. Network OpenSSL 1.01/1.02 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 1.4.3/1.4.3 Libssh2 is a client-side C library implementing the SSH2 protocol. Poco 1.4.6/1.4.7 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. C++ Rest SDK 2.4.0.1/2.4.0.1 A cross-platform library supports cloud-based client-server communication in native code using a modern asynchronous C++ API design. Azure Storage Client for C++ 0.5.0/0.5.0 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. Libcurl

(cURL) 7.30/7.40 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. Database SQLite 3.8.4.2/3.8.7.2 SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SOCI 3.2.0/3.2.2 SOCI provides C++ programmers a way to access multiple SQL databases in the most natural and intuitive way. Utility ZLib 1.2.8/1.2.8 A massively spiffy yet delicately unobtrusive compression library. LibXML2 2.7.8/2.9.2 Libxml2 is the XML C parser and toolkit available for multiple languages and platforms. TinyXML2 2.1/2.2 TinyXML-2 is a simple, small, efficient, C++ XML parser that can be easily integrating into other programs. JsonC++ 0.6/0.6 A C++ library for interacting with JSON. PThread 2.9.1/2.9.1 A library for writing multithreaded applications with POSIX threads. This is a Win32 package. Codec LibJpeg 9.0/9.0 This package contains C software to implement JPEG image encoding, decoding, and transcoding. LibPng 1.5.10/1.6.16 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).

Figure 1





Figure 2

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.