rur2641
rur2641

Reputation: 699

Linking returns error for custom installed libcurl library on Debian

I am working a Debian system running Stretch and building with g++. The latest Debian libcurl package is of libcurl version 7.38.0. I am trying to implement multipart form post by following this sample; it uses curl_mime_init which was added in libcurl version 7.56.0. I custom installed the latest version of the library and I am able to initialise a curl object but the linker returns an error for curl_mime_init().

#include<iostream>
#include <curl/curl.h>
using namespace std;

int main(){
   CURL *curl;
   curl_mime *form = NULL;

   curl_global_init(CURL_GLOBAL_ALL);
   curl = curl_easy_init();

   if(curl) 
      form = curl_mime_init(curl);
}

I didn't install the library in the proper /usr/local folder. The program is built with

g++ test.cpp -o test 
-I/home/Documents/curl-master/include 
-L/home/Documents/curl-master  -lcurl

The sample says that the exact code has not been verified to work. What could be the problem?

Upvotes: 0

Views: 185

Answers (1)

Finlay McWalter
Finlay McWalter

Reputation: 1342

I think perhaps it's your non-standard install location that's to blame. If I build the same library on Ubuntu (so that's g++ version(Ubuntu 7.3.0-16ubuntu3) 7.3.0) but I don't install it (so I just do configure and make) and then build the test with reference to that:

g++ test.cpp -o test -I/home/fin/Desktop/curl-7.61.0/include -L/home/fin/Desktop/curl-7.61.0/lib/.libs  -lcurl

then it links fine.

I should note that I didn't pass any parameters to configure

Upvotes: 1

Related Questions