I'm taking this course from Coursera and they asked us to have at least some knowledge in C .

So as they asked us to use GCC And Ubuntu , I installed both of them , I then followed this tutorial from YouTube but I had no luck running or compiling.

In fact , while I'm trying to rename my Empty file to "test.c" the icon of the file doesn't seem to change to letter "C" like his file.

As for compiling , I tried doing this :

gcc test.c -o test

but I had no chance and I received the following error code :

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

I can't understand why it says there is no such file or directory while I can clearly see the file on the Desktop.

  • 1
    if the file is on your desktop, then you need to cd Desktop before you can run that command... – Zanna Aug 1 '16 at 13:57
  • Are you sure ? as the terminal was giving "USername@username-desktop" ? – user3832856 Aug 1 '16 at 13:58
  • that looks like the name of your computer. The command will only work if the file is in the current working directory, so you have to cd to that directory first. By default when you open a terminal you are in your home directory and Desktop is a subdirectory of that. – Zanna Aug 1 '16 at 14:01

gcc will not search your computer for the file named test.c; it must be present in your working directory in your shell session.

$ pwd to see what your current working directory is.

$ ls to list the files in your working directory.

| improve this answer | |
  • pwd says "home/username" which I assume means I'm not in the desktop , and ls isn't showing the test.c logically. IF I try to do "cd desktop" It says that there is no such file or directory as well ? – user3832856 Aug 1 '16 at 14:00
  • cd Desktop. File names are case-sensitive on your linux system; desktop would not be the same as Desktop; test.c is not the same file as Test.c or test.C – user4556274 Aug 1 '16 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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