0

I'm trying to compile a program in the terminal using gcc. I'm kind of new to do this so I'm making some experiments with link various libraries. However some are working and some aren't and I wonder why and what can I do to fix this. Here's a screenshot of what I have (which also includes my version of gcc if that's relevant.

enter image description here

1 Answers1

3

You have an error with -lgd. Do you have libgd-dev installed?

guest@desktop /tmp $ cat helloworld.c
#include <stdio.h>

int main(int argc, char **argv)
{
    printf("Hello, world!\n");
    return 0;
}
guest@desktop /tmp $ gcc -o helloworld helloworld.c -lgd
/usr/bin/ldĀ : ne peut trouver -lgd
collect2: error: ld returned 1 exit status
guest@desktop /tmp $ sudo aptitude install libgd-dev
guest@desktop /tmp $ gcc -o helloworld helloworld.c -lgd
guest@desktop /tmp $ ./helloworld 
Hello, world!
ngarnier
  • 146