Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> GCC nie działa, Problem z linkowaniem?
slash12345
post
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
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Aure
post
Post #2





Grupa: Zarejestrowani
Postów: 48
Pomógł: 0
Dołączył: 3.05.2004
Skąd: Warszawa

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


Jeśli nie robiłeś restartu po instalacji to najprawdopodobniej biblioteki nie zostały zlinkowane (niektóre systemy robią to automatycznie - np. PLD (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) ). (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 2.10.2025 - 19:49