Originally published on Cohost.
Why doesn't the following code run? (comments represent different files):
// foo.hpp
// foo.cpp
// main.cpp
int
Answer
From this SO post. Basically, foo.cpp needs to be
;
void
because otherwise, member function definitions are secretly inline, and since there is no usage site in the same compilation unit they won't get exported as symbols. Declaring them like this lets them be non-inline, and the symbol can be used in the other compilation unit.
hell language btw.
