How to detect declared but undefined functions in C++?
问题 The following compiles, links and runs just fine (on Xcode 5.1 / clang): #include <iostream> class C { int foo(); }; int main(int argc, const char * argv[]) { C c; cout << "Hello world!"; } However, C::foo() is not defined anywhere, only declared. I don't get any compiler or linker warnings / errors, apparently because C::foo() is never referenced anywhere. Is there any way I can emit a warning that in the whole program no definition for C::foo() exists even though it is declared? An error