Are there good resources on how to use C++ libraries (in openFrameworks)?

These past few days I’ve been doing a lot of research into the available ofxaddons and broader the available c++ libraries. This question is specifically aimed at the latter, since I have found several c++ libraries that are of interest to me. These libraries are broadly related to two major topics:

1. Geometry processing

2. Raytrace rendering

I also found that for a few of these libraries attempts have been made to create ofxaddons:

While I appreciate these ofaxaddons, they are less useful to me, because I am on Windows.

Coming from processing / java, my inclination has always been that libraries are an easy way to quickly realise your goals by using existing quality code. In c++ I feel that using existing code sometimes can become quite an epic struggle against dependencies, compatibility issues and most importantly compilation problems.

In light of the above, I wonder if there are useful resources on how to get such c++ libraries up and running in general and/or specifically in the context of openFrameworks (maybe even through an ofxaddon).

Hoping to get some pointers on this! :smile:

Best regards,


1 Like

I realise the question posed above is generic and perhaps too broad to answer as such. There are many different third party libraries, different IDE’s and different compilers. Nevertheless, I found a few pages that I think are good introductory resources on using third party c++ libraries:

  • A short and clear description on types of libraries and how to use them on LearnCpp.
  • A question on how to use c++ libraries on StackOverFlow.
  • A question about a generic guide for using third party c++ libraries on DaniWeb.
  • A detailed beginners guide to linkers & libraries by David Drysdale.

Now while these pages help you understand the big picture (links 1, 2 & 3) and what goes on behind the scenes (link 4), I still feel there is quite a substantial gap between the described theory and the harsh reality. When trying to tackle the libraries mentioned above, these almost seem like “How to draw an owl?” instructions?

I guess, besides general knowledge on compiling/linking libraries, the only thing you can do is to carefully read and follow the instructions that come with a third party library and just try to make it work by trial-and-error, googling problems and sheer perseverance? :sweat_smile:

That has been pretty much my experience. My typical process is:

  1. Can I compile the lib on my platform?
    Often many C++ libs are in theory cross platform but you will have a much easier time on the one it was developed. For instance, I found PCL is far easier to work with on Linux

  2. Can the lib be compiled to 32 bit?
    If not you will have a difficult time getting it to work on anything but Linux and OF (as of OF 0.84). 32 bit is also required for any of the lib’s dependencies. Often the lib requires other large libs that can be difficult to get to 32 bit (QT, Boost)

  3. Can I run a 32 bit example on my platform?
    Everything compiles as 32 bit but does it actually run? This is usually the main test on whether it will work with OF.

  4. Can I include the library in an emptyExample?
    I usually take the simplest example using the library and port the code to work into ofApp. I just try to get the #include lines and and a simple declaration of one of the libs Classes at this point. Compilation/Linking errors start here. I usually reference the example’s build process/Makefile and try to get it into whatever you are building OF with.

If you get the above process working on one machine it’s then about whether you want to go back and and be ofxAddon friendly and compile static versions of the library you can distribute. (another battle in itself)


To be honest it seems that’s 75% of a coder job, by today’s standards :smile:

1 Like