How to compile and run using GCC?

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.

3

1 Answer

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.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like