Use OF as library in a different C++ project?


#1

There are several topics on this for different platforms but are either very outdated or didn’t conclude on anything concrete.
Is there maybe by now an example to access/integrate OF into other C++ projects?

I’m particularly interested in Linux x86-64.


#2

Hi, It would depend a lot on the platform and ide you are using. Are you looking for any one in particular?


#3

Oh sorry I forgot to add that. For now I only care about Linux x86-64.
CMake and make are probably the most interesting build tools as most C++ project on Linux seem to use them or in combination to generate makefiles.


#4

I played around with a cmake project but linking libopenFrameworks.a into the binary results in a

/usr/bin/ld: include/openFrameworks/libs/openFrameworksCompiled/lib/linux64/libopenFrameworks.a(ofCairoRenderer.o): undefined reference to symbol 'cairo_svg_surface_create'
//usr/lib/x86_64-linux-gnu/libcairo.so.2: error adding symbols: DSO missing from command line

It’s this kind of stuff where I’m kind of lost and not sure how to resolve this or why I get this error to begin with.

E: Ok I could resolve this by linking against that shared library but this seems like a deep rabbit hole. Is it really necessary to link against all these shared libraries?
After adding libcairo I get:

/usr/bin/ld: include/openFrameworks/libs/openFrameworksCompiled/lib/linux64/libopenFrameworks.a(ofTrueTypeFont.o): undefined reference to symbol 'FcInit'
//usr/lib/x86_64-linux-gnu/libfontconfig.so.1: error adding symbols: DSO missing from command line

#5

I am not a Linux person, so I can not give much specific help here. @arturo is the man.

openFrameworks bundles several libraries, which all are located inside the libs folder, there you’ll find all the needed libraries, already compiled as well as the headers(includes) you’lll need. You can take a look into libs/openFrameworksCompiled/project/makefileCommon/ which is where you’ll find the make files.
hope this is any help.
cheers


#6

Thank you. I’m familiar with some of the makefiles but I think I just don’t know enough about the whole OF structure yet to get this linked correctly in a different build system.