Skip to content
Sign upLog in
← Back to Community

libcurl fails to function

Profile icon
LukeZeller

i am trying to use the libcurl source in a simple test application, but when I run it I get:

main.cpp:9:17: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings] char *url = "http://stackoverflow.com"; ^ 1 warning generated. /tmp/main-428a37.o: In function `main': main.cpp:(.text+0x41): undefined reference to `curl_easy_init' main.cpp:(.text+0x7e): undefined reference to `curl_easy_setopt' main.cpp:(.text+0x98): undefined reference to `curl_easy_setopt' main.cpp:(.text+0xb2): undefined reference to `curl_easy_setopt' main.cpp:(.text+0xc1): undefined reference to `curl_easy_perform' main.cpp:(.text+0xcd): undefined reference to `curl_easy_cleanup' clang: error: linker command failed with exit code 1 (use -v to see invocation) compiler exit status 1

does anyone know what causes this? the website says I can use it with c++
heres a link to the repl: https://repl.it/@LukeZeller/FTP

Voters
Profile icon
LukeZeller
Comments
hotnewtop
Profile icon
[deleted]

It looks pretty fierce/advanced looking code. Do you understand it or did you just copy and paste it from somewhere and hoped it would work?

Profile icon
LukeZeller

@malvoliothegood
i copied it from the libcurl website. its the script thats supposed to test the library.

Profile icon
[deleted]

@LukeZeller

I googled your error and found an answer on this page that could help you: https://www.quora.com/Why-are-string-literal-conversions-to-char*-deprecated-in-C++