how to include new libraries


not sure if this is more of a c++ or even IDE-specific question, but I’m trying to test some libraries which are not part of openframeworks (for screen recording or high level audio, for example). The thing is… I’m not able to make anything work. I usually get tons of errors when just including the h and cpp files from the library

I was wondering if there is some usual steps (or perhaps a web resource) for including external libraries in openframeworks/c++ which I’m missing.

I’m more interested in the general steps than a specific example, but this is an example of what I was trying to integrate (codewarrior/win)

thanks a lot.

hi jesus,

did you try this instruction in the description:

If you want to use CAviGenerator without MFC, undefine _AVIGENERATOR_MFC in AviGenerator.h. It will disable MFC function calls.

take care,

yes, i did. but I got errors for missing h files.

anyway, That one was just one of the libs I tried… I realize it has more to do with my current inexperience with c++ than openframeworks so I’ll have to dig deeper, I guess.

well - there isn’t a general rule about how to do it, but there are some strategies:

a) stick with modern libraries, or code that you don’t have to rip out from a larger codebase. There is alot of code out there, some of it is easier or much better documented then others, and it makes a big difference in compiling.

b) try to find example projects that use that library that might be helpful as a reference.

c) look for code that looks actively maintained. If it’s on sourceforge, for example, is the forum active? Have there been changes in the last year?

d) When you compile, start with just trying to compile the lib itself as a lib. What kind of errors come up? You can likely find many of the needed .h files (for compile errors) or .lib files (for link errors) just by googling. It’s amazing, but adding the right include, can make a project go from 500+ errors to something something more manageable.

As you start to dabble around, you will get used to various code styles, from the old-school (ie, numerical recipies type code) to the new school (templates, etc), the way the libraries work (ie, callback, interfaces, etc) and from there you might have better luck picking code to try.

I would like to make a short tutorial about this, when I have a second, because it might be helpful to just look at a case study, and what goes into getting libraries to work. I haven’t done it before (taken notes) about the process, but it seems like it might be helpful. I’ll try to do that in the future.

In the meantime, if you want to email me off-line, or do it online - it might be nice to see the kinds of errors you have and if it’s possible to work through them…

take care!!

yeah, thanks a lot zach. really helpful. specially the compile as lib thing.

I’ll try again and let you know

thank you!