I have written a program that prints out all the permutations of the characters in a string literal. I have a segmentation fault and for the first time using a debugger (gdb). How do I include the -g sign in the makefile. Here is the make file
When I type make in the cmd prompt I get -g attached at the end. like soCode:CC=gcc CARGS=-g list: perm.o data_list.o stack_list.o cmdline.o $(CC) -o perm perm.o data_list.o stack_list.o cmdline.o perm.o: perm.c data.h stack.h cmdline.h $(CC) -o perm.o perm.c $(CARGS) data_list.o: data_list.c data.h $(CC) -o data_list.o data_list.c $(CARGS) stack_list.o: stack_list.c stack.h $(CC) -o stack_list.o stack_list.c $(CARGS) cmdline.o: cmdline.c cmdline.h $(CC) -o cmdline.o -c cmdline.c $(OPTS)
gcc -o data_list.o data_list.c -g
The examples on the net show that -g should follow gcc . I get the error
In function `_start':
(.text+0x20): undefined reference to `main'
So I got two problems. It does not even compile and once I go to gdb I and I type any command (for example list) I get the error no symbol table. advice please.
I see I need to have -c option there my bad. Please answer the second question