Question
Can someone please tell me how to compile from the command line in a clear, concise way. Preferably, my programs will be written in a real text editor (such as leaf pad).
Background
I am a complete n00b when it comes to Linux, C, and the Raspberry Pi. So, the three have come together in a perfect storm to attack!
I have created a C file called main.c
in a folder. The directory is:
/home/pi/Desktop/Data Base/main.c
The C
code is a simple Hello World program - I don't need to explain it here. So, I have naturally decided to compile my C code, and it is here that I come to a loss. I type in
gcc -o hello main.c
as told in this tutorial, but I come to an error:
gcc: error: main.c: No such file or directory
When I did the nano
stuff, I came to a weird window, but I didn't know how to save what I wrote.
Thanks so much - this has been bugging me hugely.
ctrl-o
, but it also asks you to save when you exit viactrl-x
. Learn to use thels
andstat
command for reading directory contents, also maybepwd
andcd
as you could be getting confused about where you are.