I've started working with libcurl for couple hours. But it occurs too many errors at once. This is my code in main.cpp:
#include <iostream>
#include "curl-7.53.1/include/curl/curl.h"
using namespace std;
int main(int argc, char *argv[])
{
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl){
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/like.php");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "mediaId=4665");
res = curl_easy_perform(curl);
if(res!=CURLE_OK)
cout«"something went wrong.";
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
So these are the errors:
/home/muhammad/Documents/Qt projects/untitled3/main.cpp:-1: error: undefined reference to `curl_global_init'
/home/muhammad/Documents/Qt projects/untitled3/main.cpp:-1: error: undefined reference to `curl_easy_init'
/home/muhammad/Documents/Qt projects/untitled3/main.cpp:-1: error: undefined reference to `curl_easy_setopt'
/home/muhammad/Documents/Qt projects/untitled3/main.cpp:-1: error: undefined reference to `curl_easy_setopt'
/home/muhammad/Documents/Qt projects/untitled3/main.cpp:-1: error: undefined reference to `curl_easy_perform'
/home/muhammad/Documents/Qt projects/untitled3/main.cpp:-1: error: undefined reference to `curl_easy_cleanup'
/home/muhammad/Documents/Qt projects/untitled3/main.cpp:-1: error: undefined reference to `curl_global_cleanup'
How can I solve them? (OS is linux ubuntu)