Hi,
I have a header file in which I declare a class. A member function foo() is declared as inline. In another .cpp file, I define the function foo(). I create an object in main() (in another .cpp file) and invoke the foo() using that object. When I compile the individual files it works fine, but while linking (g++), getting error "undefined reference to myClass :: foo() in main()".
When I remove "inline" from declaration and definition of foo(), linking is done and it all works fine. However, I could not understand the reason behind the error in the first place. Could somebody please explain the same?
Thanks.