I have two headers.
// header1.h
class A
{
public:
void f();
};
// header2.h
#include "header1.h"
inline void A::f()
{
std::cout << "Yahoo.";
}
// test1.cpp
#include "header1.h"
int main() { A a; a.f(); return 0; }
// test2.cpp
#include "header2.h"
void ff() { /* do nothing */ }
I got a link error on MSVC 2013. I only got one translation unit, so I think that maybe "ODR" is not the reason?
Now I have test2.cpp to include header2.h. So I think that linker can find header2.h now. But still link error, why?