I\'m using a shared library that defines inline functions in its header.
Here is a reduced test case, as seen by the compilation unit linking to the library (for the
Further information to Chris Dodd's answer:
I tested with MSVC 2017 and MinGW-w64 7.2.0; in both cases, with optimization enabled, the call of myFunc1()
from myFunc2
resolved to the inline version, despite the warning. Even if the body of myFunc1
were moved to below main()
.
So my tentative conclusion is that it is safe to ignore this warning.
In the interest of a clean compile, the only method that seems to work in MinGW-w64 is to mark the function declaration within the class definition as inline
. The compiler does not allow applying __declspec(dllimport)
to the out-of-class function definition.
I have been unable to determine if there is a warning flag for g++ which will specifically disable this warning.