Link external shared curl library with qbs to project not working

I am using Xubuntu 16.04 64bit, OF v0.9.8_linux64_release and Qt Creator 4.2.1.
I need to use libcurl. But when I change the section :
of.linkerFlags: [ ‘-lcurl’ ] // flags passed to the linker
in the file myproject.qbs the linker still can not find libcurl.so library.
When I add USER_LIBS=-lcurl to config.make building from make command is working ok.
Linker output from QtCreator is follows:

compiling ofApp.cpp
compiling main.cpp
linking myproject_debug
/usr/bin/g++ -Wl,--unresolved-symbols=ignore-in-shared-libs -m64 -lcurl -o /media/data/software/of_v0.9.8_linux64_release/apps/myApps/myproject/bin/myrpoject_debug .....

so curl is included but linker can not find it:

 /media/data/software/of_v0.9.8_linux64_release/apps/myApps/myproject/src/ofApp.cpp:218: undefined reference to `curl_easy_setopt' ...

libcurl is located in /usr/lib/x86_64-linux-gnu/libcurl.so

Even if i set linking static library with absolute path
of.linkerFlags: [ '/usr/lib/x86_64-linux-gnu/libcurl.a' ]

the linker still reports undefined reference to 'curl_easy_setopt' ...

Solved.
The library must be in qbs entered in section cpp module.
When I added cpp.dynamicLibraries: [“curl”] linking process is now working.

Really stuck trying to do this currently on similar setup (ubuntu 16.04 64bit, OF v0.9.8_linux64_release and Qt Creator 4.1.0).

How exactly did you get yours working in the end? Was it using the shared or static library?

Thanks!

Finally I use dynamic version of linking. You have to add line cpp.dynamicLibraries: ["curl"] to file project.qbs and recompile project.

1 Like