LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C debug problem (https://www.linuxquestions.org/questions/programming-9/c-debug-problem-8413/)

miasmak 11-07-2001 03:06 PM

C debug problem
 
When I compile and link my hello world proggy with -g option using gcc, I can see the source in gdb.

gcc -g -o hello helloworld.c

However ...

when I compile with -g and generate a helloword.o and then link in a separate step I cannot see the source in gdb.

gcc -g -o helloworld.o helloworld.c
gcc -g -o hello helloworld.o

Am I missing a link option?

Does anybody have a clue? Any help will be appreciated.

tia

isajera 11-07-2001 03:39 PM

ummm... what do you mean by source? the helloworld.c file? or the helloworld.o object file?

miasmak 11-08-2001 06:48 AM

I can't see the helloworld.c source code. I can't single step or look at variables.

Thomas.P 11-11-2001 10:50 PM

I think u should use the -c flag instead of -g to create the helloworld.o file.

The code would be :

gcc -c -o helloworld.o helloworld.c
gcc -g -o hello helloworld.o

isajera 11-12-2001 01:33 PM

no... that's not exactly what she's asking... she's using the gbd (gnu debugger) to check the program. i've never used it... so i can't really offer any advice on it.


All times are GMT -5. The time now is 07:48 AM.