I am getting the following from gdb:

enter image description here

Below is the source of the program and the tutorial it came from. BAsed on what is going on in the tutorial, I should not be getting an error.

int main()
    int a = 5;
    int b = a + 6;
    return b;


1 Answer 1


You need debugging symbols for the variable names to be defined in GDB. Did you compile with the -g switch?

  • Yes, and after compiling it again it worked fine.
    – user8058
    Commented Jul 14, 2014 at 20:13
  • You mean the debugging or the program worked? If the debugging is working as you wanted please mark this question as solved.
    – ekse
    Commented Jul 15, 2014 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.