- Katılım
- 26 Mart 2020
- Mesajlar
- 3,965
- Çözümler
- 1
- Reaksiyon puanı
- 4,602
- Puanları
- 358
- Yaş
- 16
- Konum
- Istanbul
Aşağıdaki kodları
Bilen yok mu?
cURL sorunlarını çözdüm arkadaşlar, derlerken
gcc main.c -o main
olarak derliyorum ve libcurl4-gnutls-dev paketi kurulu. Neyi yanlış yapıyorum?
C:
#include <stdio.h>
#include <curl/curl.h>
#include <string.h>
int main(void)
{
char *veri;
char *data;
printf("Veri Girin: ");
scanf("%c", &veri);
CURL *curl;
CURLcode res;
data = strcat("https://growforum.tk/api/?data=", veri);
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, data);
res = curl_easy_perform(curl);
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
curl_easy_cleanup(curl);
}
printf("Sonuç: %d", res);
return 0;
}
Kod:
main.c: In function ‘main’:
main.c:10:11: warning: format ‘%c’ expects argument of type ‘char *’, but argument 2 has type ‘char **’ [-Wformat=]
10 | scanf("%c", &veri);
| ~^ ~~~~~
| | |
| | char **
| char *
/usr/bin/ld: /tmp/ccymCODi.o: in function `main':
main.c:(.text+0x1a6): undefined reference to `curl_easy_init'
/usr/bin/ld: main.c:(.text+0x1d2): undefined reference to `curl_easy_setopt'
/usr/bin/ld: main.c:(.text+0x1de): undefined reference to `curl_easy_perform'
/usr/bin/ld: main.c:(.text+0x1f1): undefined reference to `curl_easy_strerror'
/usr/bin/ld: main.c:(.text+0x21b): undefined reference to `curl_easy_cleanup'
collect2: error: ld returned 1 exit status
Mesaj otomatik birleştirildi:
Bilen yok mu?
Mesaj otomatik birleştirildi:
cURL sorunlarını çözdüm arkadaşlar, derlerken
gcc main.c -o main
yerine gcc main.c -lcurl -o main
yazıyoruz. Ama char** ile alakalı olanı çözemedim.
Son düzenleme: