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

closed as off-topic by muru, David Foerster, Pilot6, MadMike, user68186 Feb 24 '17 at 20:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – muru, David Foerster, Pilot6, MadMike, user68186
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Generic programming questions should be asked on Stack Overflow. – muru Feb 23 '17 at 11:35
  • 2
    Could you please post text files, dialogue messages, and program output listings as text, not as images? To achieve the latter two you can either 1) select, copy & paste the dialogue text or terminal content or 2) save the program output to a file and use that. Longer listings (≥100 lines) should be uploaded to a pastie service and linked to in the question. Thanks. – David Foerster Feb 23 '17 at 16:15
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!

Not the answer you're looking for? Browse other questions tagged or ask your own question.