-2

I am new to Linux and I am trying to learn how to run and debug my programs using GCC and GDB. I set my Visual Studio Code to run and debug C/C++ programs and I wrote a simple code that implements a list. When I hit Run>Start Debugging in VSC everything works fine and the output is as expected.

However I want to compile my code using gcc and to debug it using gdb. When trying to compile using gcc I get the following.

  • 1
    Use `g++` to compile C++ code. – Retired Ninja Aug 16 '21 at 15:39
  • 4
    Please don't post images: I currently am unable to view it, and therefore have no idea what you're talking about. Copy/pasting the text is arguably easier and faster than screen-grabbing, uploading, and linking an image as well. – sweenish Aug 16 '21 at 15:39

1 Answers1

1

Use g++ to compile C++ code. gcc is for C code. The undefined references are the result of gcc not linking to the C++ standard library.

Yun
  • 3,056
  • 6
  • 9
  • 28