I am working on a Raspberry Pi project whereby we need to program a robot to run by itself.
Currently I am using Geany as the Environment and C programming language. The steps are obtained from the following tutorial:
However because I have never done this before, I encountered a problem. The website says Geany requires a 'makefile' to execute the program. I created a simple main.c and makefile
main.c
int main(int argc, char **argv)
{
printf("Hello world!");
return 0;
}
makefile
CC=gcc
CFLAGS=-I.
DEPS =
all: main.o
gcc main.o -o target_bin
main.o: main.c
gcc -I . -c main.c
clean:
rm -rf *.o
rm target_bin
From Geany, I tried to Build/Compile/Make but I keep getting error like:
'make' is not recognized as an internal or external command
I tried compiling the main.c
via command prompt, but it still prompts me with the same error:
'gcc' is not recognized as an internal or external command,
In summary, I have no idea how to make a makefile. Can anyone guide me?
Execute
sudo apt-get install build-essential
to install the compiler and a bunch of other goodies. I would executesudo apt-get update
first to ensure your system is up to date.For the GNU
make
docs:http://www.gnu.org/software/make/manual/make.html