Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link Poco library(libraries) to our program in unix environment

I'm having trouble with Poco libraries. I need a simple solution to make the compilation easier. Is there any pkg-config file for Poco library to use it into our make files? Or any alternative solution?

Currently I use Ubuntu GNU/Linux.

I'm trying to use poco libraries in my app, but I don't know how to link Poco libraries to it. In fact I don't know how many libraries should be linked against the app. I want to know if there is an easy way to do it, such as using pkg-config files, as we do with gtkmm, for example:

g++ prog.cc `pkg-config --gtkmm-2.4 --libs --cflags` -o prog

and the pkg-config program appends appropriate libs and header files to our command.

like image 956
sepisoad Avatar asked Mar 22 '10 08:03

sepisoad


1 Answers

On ubuntu 16.04 you'll first need to install Poco libraries accordingly, that is done as follows:

sudo apt install libpoco-dev

Then you'll need to add the proper instructions to the linker, it will depend on the includes you have, for example if you used

#include <Poco/Net/MailMessage.h>

You'll need the following switches:

-lPocoNet -lPocoFoundation

ej:

g++ main.cpp -Wall -std=c++11 -o pocotest -lPocoNet -lPocoFoundation
like image 160
dvisor Avatar answered Oct 15 '22 01:10

dvisor