Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> GCC nie działa, Problem z linkowaniem?
slash12345
post 23.07.2006, 17:28:19
Post #1





Grupa: Zarejestrowani
Postów: 70
Pomógł: 0
Dołączył: 21.04.2006

Ostrzeżenie: (0%)
-----


Witam,
Po przeczytaniu trochę o cURL postanowiłem napisać program w C, używający tej biblioteki. Niby wszystko ładnie, program jednak się nie kompilował. Sprawdziłem więc, czy przykładowy program z oficjalnej strony uda się skompilować. Oto kod źródłowy:
Kod
#include <stdio.h>
#include <curl/curl.h>

int main(void)
{
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
    res = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return 0;
}


Potem piszę sobie:
$ gcc knights.c

I dostaję błąd:
/tmp/ccIrILAj.o: In function `main':
knights.c:(.text+0x9): undefined reference to `curl_easy_init'
knights.c:(.text+0x2c): undefined reference to `curl_easy_setopt'
knights.c:(.text+0x35): undefined reference to `curl_easy_perform'
knights.c:(.text+0x41): undefined reference to `curl_easy_cleanup'
collect2: ld returned 1 exit status
To były tylko wywołania funkcji! Jakim więc cudem TO może nie działać?

Ten post edytował slash12345 23.07.2006, 17:28:56


--------------------
Kod
thewanderer@debian:~$ sudo apt-get dist-upgrade
Konieczne pobranie 666KB pakietów. Czy chcesz kontynuować? [T/n] nieeeeeeee
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 10:50