Adding A Library To A NetBeans Project

For example the bcm2835 library for the IO pins.

Include the library header file

#include <bcm2835.h>

When you compile you the compiler also needs to include the library so the libraries object file is added to the final compilation.

Right click the project > Properties > Build > Linker > In the 'Libraries' section press the '…' button > Add Option… > Other Option > Enter your libraries option, e.g.: -lbcm2835

Command line options

For example the mysql libraries require this:

Project Properties > Build > Linker > Compilation Line > Additional Options > paste in this: `mysql_config --cflags` `mysql_config --libs`

(Note the single quote marks are correct and should be used!)

Examples Of Adding More Complex Libraries

This can be handy if you need to work out how to include library directories, options, etc:

GTK graphics library

My SQL library