From the course: Debugging in C++ with Visual Studio Code

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Linker errors

Linker errors

- [Instructor] Lastly, we have linker errors, which are among the trickiest. As you may know, the linker performs one of the final steps in the compiling process. Its task is to stitch together several pieces of code to create the finished executable. So naturally, several source files and libraries are involved. Sometimes, even the compiler or linter struggles to provide information about linker errors, leaving us with poor, cryptic messages. We have two linker errors in this code, but the linter isn't helping. Look at the vertical scroll bar on the right. There are no red markers, so there are no squiggles in the code. Again, the reason for this is that the linker works at a late stage of the compiling process. Let's try to build to see if we can reveal these problems. Now we have a squiggle in line 12. The error reads, "redefinition of double globalDiscount." It turns out this variable was already declared and initialized in globals.h. Let's see it. This header file is very…

Contents