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.
I don't think Poco comes with any pre-packaged ".pc" files but you should be able to create your own easily and stick them in the lib/pkgconfig directory on your system if you prefer that method.
I don't know exactly where you installed Poco on your system so you may have to do a "find" to locate your files. To compile you need to specify the poco header directory, the poco library directory, and the individual poco libraries. So something like:
g++ -I<path-to-poco-include-dir> -o prog prog.cpp -L<path-to-poco-lib-dir> -l<some-poco-lib> -l<another-poco-lib>
For example:
g++ -I/usr/local/Poco/include -o prog prog.cpp -L/usr/local/Poco/lib -lPocoFoundation -lPocoNet -lPocoNetSSL -lPocoUtil -lPocoXML
There are 20 or so different poco .so files so you obviously need to link the proper ones. Poco makes this pretty easy since the library names conform to the documentation sections - e.g. util stuff is in libPocoUtil.so. If you also compiled debug versions of the libraries they will end in 'd' - e.g. libPocoUtild.so
Again, once you locate all your files you may prefer to create your own poco.pc since you should have the information you need to create it.