Score:0

Ubuntu based program wont compile

sr flag

I am learning C language via "C For Dummies" and am writing a program for Ubuntu. I have written the program but cannot compile it. I installed a gcc, wrote the program and thought I was in the correct folder. The program is named Goodbye.c. The code is written as follows:

#include <stdio.h>

int main()
{
   printf(Goodbye, cruel world!\n");
   return(0);
}

When I attempt to enter the command gcc goodbye.c -o goodbye I am given the message

gcc: error: goodbye.c: No such file or directory
gcc: fatal error: no input files compilation terminated.

What am I doing wrong? How do I get the program to compile correctly in order for me to be able to run it?

guiverc avatar
cn flag
Please re-read your question; you mention the file is named `Goodbye.c` but your compile refers to it as `goodbye.c` which is a different filename (ie. G & g are different characters!)
Mckimmz avatar
sr flag
Ok i have renamed the program goodbye.c now im getting error messages needing a semicolon before "return" and at the end of line 7. I have entered those but it still gives me those same errors. What next?
Score:3
tk flag

Ubuntu is case sensitive, unlike Windows. Therefore goodbye.c is different from Goodbye.c.

Also, if that is your exact code, you will get another error:

printf(Goodbye, cruel world!\n");

needs an opening quote; it should be

printf("Goodbye, cruel world!\n");
Mckimmz avatar
sr flag
Ok i have renamed the program goodbye.c now im getting error messages needing a semicolon before "return" and at the end of line 7. I have entered those but it still gives me those same errors. What next?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.