Re: No symbol "xx" in current context.

Compass <luopan81@xxxxxxxxx> wrote:
I have a class in file1.cpp file1.h. The main in main.cpp.
Compiled with:
g++ -g -c file1.cpp -o file1.o
g++ -g -c main.cpp -o main.o
g++ file1.o main.o -o main
Then gdb main
I can't print local vars in file1.cpp.
Is there anything wrong?

You're really not giving too much details so all I can do
is guess. It could be that the compiler has "optimized out"
those local variables, just keeping them in CPU registers
instead of using memory on the stack, so for the debugger
they don't exist as variables. Try to compile again with
the additional '-O0' option (that's an uppercase 'o' letter,
followed by a zero) to keep the compiler from doing any
optimizations and see if it then works.

Regards, Jens
\ Jens Thoms Toerring ___ jt@xxxxxxxxxxx