Libcurl undefined reference

Viewed 22

I'm trying to compile a testing C++ application on OpenWRT using g++. When I try to compile, I get an error with undefined references.

Code:

#include <curl/curl.h>

int main() {
    CURL* curl;
    curl = curl_easy_init();
    curl_easy_cleanup(curl);
    return 0;
}

Error:

root@OpenWrt:/cpp# g++ test.cpp -lcurl
/tmp/ccDFnfEK.o: In function `main':
test.cpp:(.text+0xc): undefined reference to `curl_easy_init'
test.cpp:(.text+0x1c): undefined reference to `curl_easy_cleanup'
collect2: error: ld returned 1 exit status

I tried compiling with /usr/lib/libcurl.so instead of -lcurl or compiling without any arguments but I'm getting same error

0 Answers
Related