Ask / Submit
1

Using libcurl or a C++ Wrapper

asked 2018-04-02 02:58:45 +0200

m3x1m0m gravatar image

updated 2018-04-02 15:14:49 +0200

Edz gravatar image

Just wondering if I am the first one who wants to use libcurl or rather a curl C++ wrapper for a Sailfish app. There is for instance this project, which is nice: https://github.com/jpbarrette/curlpp . I guess I have to compile the wrapper myself. However, libcurl, I saw, is available. I quickly logged into the build engine and installed licurl:

i | libcurl | A library for getting files from web servers | package   
i | libcurl-devel | Files needed for building applications with libcurl | package

Also I added

LIBS += \
-lcurl

Unfortunately, the linker says it can't find -lcurl, although

curl-config --libs

gives

-lcurl

Does anybody have experiences with libcurl/libcurlpp or even an example?

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
2

answered 2018-04-02 08:37:48 +0200

rinigus gravatar image

updated 2018-04-02 19:40:37 +0200

I am using libcurl to communicate between some daemons of OSM Scout Server. Relevant sections:

PRO (https://github.com/rinigus/osmscout-server/blob/master/osmscout-server_silica.pro#L163)

PKGCONFIG += libcurl

As usual, you would have to include libcurl as a part of the app. See https://github.com/rinigus/osmscout-server/blob/master/rpm/harbour-osmscout-server.spec for how to do that

Edit: Solution simplified in accordance with @coderus suggestion.

edit flag offensive delete publish link more

Comments

Thank you. It works with pkg-config. I saw in your code, that you are using the raw C library curl. You know if anybody uses a C++ wrapper?

m3x1m0m ( 2018-04-02 14:01:43 +0200 )edit

No, I don't know, unfortunately

rinigus ( 2018-04-02 14:15:20 +0200 )edit
2

those disappear if we use PKGCONFIG

do not add it manually, because of https://github.com/sailfishos/libsailfishapp/blob/master/data/sailfishapp.prf#L62

so the only lines you need are:

CONFIG += sailfishapp

PKGCONFIG += libcurl
coderus ( 2018-04-02 17:59:21 +0200 )edit

@coderus, thanks! Looking forward to test it!

rinigus ( 2018-04-02 19:09:06 +0200 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2018-04-02 02:58:45 +0200

Seen: 322 times

Last updated: Apr 02 '18