TransWikia.com

Using libcurl in g++

Stack Overflow Asked by Marcel Kopera on February 16, 2021

Sorry, if stupid question, I’m kind of new in compiling a c++ program. I’m doing it with g++ and command line on Ubuntu. Last day I had to use external library libcurl -> #include <curl/curl.h>. So I installed it and added -lcurl flag when compiling. Like this g++ vpn.cpp -o vpn -lcurl It works nice, but when I want to execute the same file on another computer I get an error that curl is not installed. Is there a way to be able to include #include <curl/curl.h> in the output file, so I will be able to execute the file without installing additional libraries on host pc?

error

error while loading shared libraries: libcurl-nss.so.4: cannot open shared object file: No such file or directory

This is what I tried

g++ -c vpn.cpp / ar rvs libcurl.a vpn.o / g++ vpn.cpp libcurl.a -DCURL_STATICLIB -lcurl -o vpns

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP