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

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *