[Solved] Unresolved External Symbol in C++ Header


Nevermind, figured it out after enough experimentation. Thanks to @Ron for the help. I apologize for rephrasing the question (didn’t know that it would erase your answer).

If you run into the same problem…

I ended up putting #pragma once at the top of the header file, declaring each variable with extern in the header file, then explicitly defining each variable in the global scope of main.cpp (outside / above of the main method).

pragma once tells the preprocessor to only include the file once in a compilation. It acts the same as include guards, but with less code. Extern tells the program that the variable is defined / stored somewhere else in the code.

Hope that helps anyone who runs into the same problem in the future!

1

solved Unresolved External Symbol in C++ Header