On Mon, Apr 10, 2000 at 03:45:31AM +0800, maths wrote: > hello everybody: > > i wrote all function in a .h file, and include it in a mian > file, then cc -g ... late i use gdb to debug, when i use > command "list", it just list the code in main file, how can > i list the codes in .h file, so i can inset a break point or > something else? > by the way, where can i find good tutorial of GDB? > > thank you verymuch!
Most people do not put functions on a .h file. That is where headers go (function and global declerations). If you want to do this right, put those functions either in the main.c, or even better: move them all to it's own .c file, and make the .h only contain function declerations of those functions, then compile like so: gcc -g -c main.c -o main.o gcc -g -c util.c -o util.o gcc main.o util.o -o myprogram Then you can debug the program (-g ensures debugging code is included as you probably already know). You can set the break point by line number in util.c. -- -----------=======-=-======-=========-----------=====------------=-=------ / Ben Collins -- ...on that fantastic voyage... -- Debian GNU/Linux \ ` [EMAIL PROTECTED] -- [EMAIL PROTECTED] -- [EMAIL PROTECTED] ' `---=========------=======-------------=-=-----=-===-======-------=--=---'