I just had a pretty simple c++ compilation question. I am curious whether my knowledge is flawed, or if this is another symptom of a non-standard MSVC++ 6 compiler.
In file test.h, I declare extern const std::string strTest.
In file main.cpp I define const std::string strTest = "Test". Main.cpp does not include test.h.
other.cpp includes test.h. It uses strTest in one of its functions.
When I compile, the linker says strTest is undefined.
My understanding was every cpp file in a project gets compiled. Since there is a definition for strTest in main.cpp, it is a declared identifier. The external designation in test.h should be paired with the definition in main.cpp. Is this the case, or is my knowledge of the standard c++ compilation flawed?