Please use [code] tags to improve reabaility of your posts.
Try a different Makefile. This one is quite nice and easy to maintain for small projects:
Code:
CC = gcc
CFLAGS = -g
LFLAGS =
OBJECTS = temp.o
EXECUTABLE = myprog
$(EXECUTABLE) : $(OBJECTS)
gcc $(LFLAGS) $(OBJECTS) -o $@
clean :
rm -f $(OBJECTS) $(EXECUTABLE)
%.o : %.c
gcc -c $(CFLAGS) $< -o $@
As you add more sources, just add the names of the object files they will build to OBJECTS. he rest is automatic.
To prevent warnings, and to be standards compliant, don't forget to add the proper arguments to main():
Code:
#include <stdio.h>
int main(int argc, char** argv)
{
int a = 0;
printf("The number is %d\n",a);
return 0;
}