Question

I am trying to use POCO C++ Library with Netbeans IDE on Ubuntu Linux 13.04. I have downloaded, build and installed the POCO C++ Library. The library can be found in the directory "/usr/local/include/Poco". I would like to know how to add the POCO C++ Library to the Netbeans IDE and be able to work with it. Please answer with details.

Thank You

Was it helpful?

Solution

To link an external libraries you need in general three things:

  1. To add the header files as an include directory -I flag
  2. To add the library path to your POCO C++ *.so files -L flag
  3. To add the library name to your compiler without the lib prefix, for example with poco would be poco-Foundation and the name of your file in your system would be libpoco-Foundation.so

Now for Netbeans specific

For the header files

File -> Project Properties -> Build -> C++ Compiler -> General -> Include Directories which is step one

For the library directories

Project -> properties -> Linker -> Additional Library Directories which is step two

For the library

Project -> properties -> Linker ->Libraries -> Add option -> Other is only for the library file, which is step three.

In the case of the Poco Libraries they are usually handled like the Boost Libraries, for example

#include "Poco/AutoPtr.h"

This means the Include Directory has to be one level up from the Poco folder. For example if your Poco folder is on "/usr/local/include/Poco" then you need to add the "/usr/local/include" to your Include Directories (from step one).

As for the -L/usr/local/include/Poco This is not how it is done. This path is the path to your specific library, in the case of poco there is Foundation, XML, Net, and Util along with the test projects. You need to find the files that are named libPoco-*.so where "*" means something. This is most likely in your the directory usr/local/lib if those files are not there then they are most likely in usr/local/lib/Poco

If there are no files named libPoco-*.so you have to build your Poco libraries separately.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top