카테고리 없음

[curl] compile 방법

개발자_이훈규 2014. 1. 16. 22:31

http://www.joinc.co.kr/modules/moniwiki//wiki.php/Site/Web/documents/UsedCurl


http://stackoverflow.com/questions/16476196/undefined-reference-to-curl-global-init-curl-easy-init-and-other-functionc


I am trying to use Curl in C.

I visited Curl official page, and copied sample source code.

below is the link: http://curl.haxx.se/libcurl/c/sepheaders.html

when I run this code with command "gcc test.c",

the console shows message like below.

/tmp/cc1vsivQ.o: In function `main':
test.c:(.text+0xe1): undefined reference to `curl_global_init'
test.c:(.text+0xe6): undefined reference to `curl_easy_init'
test.c:(.text+0x10c): undefined reference to `curl_easy_setopt'
test.c:(.text+0x12e): undefined reference to `curl_easy_setopt'
test.c:(.text+0x150): undefined reference to `curl_easy_setopt'
test.c:(.text+0x17e): undefined reference to `curl_easy_cleanup'
test.c:(.text+0x1b3): undefined reference to `curl_easy_cleanup'
test.c:(.text+0x1db): undefined reference to `curl_easy_setopt'
test.c:(.text+0x1e7): undefined reference to `curl_easy_perform'
test.c:(.text+0x1ff): undefined reference to `curl_easy_cleanup'

I do not know how to solve this.


이런 문구가 나올 경우엔 이것만 하면 된다.

$ gcc test.c -lcurl

라이브러리를 추가해준다.