Still cannot print variable
Eli Zaretskii
eliz@gnu.org
Fri Apr 15 09:30:00 GMT 2005
> From: JS <fedevaps@yahoo.dk>
> Date: Fri, 15 Apr 2005 11:09:09 +0200
>
> I am still have problems printing a variable. I have this code in a file
> called test.:
>
> int main()
> {
>
> int d = 119;
>
> return(0);
>
> }
>
> I then compile it like this:
>
> gcc -g -Wall -o test test.c
>
> (I have also tried with option -O0 but that changes nothing).
>
> I run "gdb test" followed by "print d" and then I get this error:
>
> No symbol "d" in current context.
You need to get to the main function, since "d" is a local variable.
After you do get to main, step one line to get past the assignment of
119 to "d", and then print its value.
When I do this, I get the value of "d" printed as I'd expect.
More information about the Gdb
mailing list