Is there a way to ignore unused undefined references?
问题 Suppose I have two source files — UndefErr.cpp : #include <cstdio> void UndefFunc(); void Func2(){UndefFunc();} void Func1(){printf("Hi\n");} And the main.cpp : void Func1(); int main(){ Func1(); return 0; } As you see in the UndefErr.cpp the Func2() going to trigger an error, for it using the undefined UndefFunc() . However the main function doesn't care about the Func2() ! According to a relevant question I could pass an option --unresolved-symbols=ignore-in-object-files to the linker, but