filter must be one of the following values.
Table A–9 The -filt Values
Value |
Meaning |
---|---|
[no%]errors |
[Do not] Show the C++ explanations of the linker error messages. The suppression of the explanations is useful when the linker diagnostics are provided directly to another tool. |
[no%]names |
[Do not] Demangle the C++ mangled linker names. |
[no%]returns |
[Do not] Demangle the return types of functions. Suppression of this type of demangling helps you to identify function names more quickly, but note that in the case of co-variant returns some functions differ only in the return type. |
[no%]stdlib |
[Do not] Simplify names from the standard library in both the linker and compiler error messages. This makes it easier for you to recognize the names of standard library template types. |
%all |
Equivalent to -filt=errors,names,returns,stdlib. This is the default behavior. |
%none |
Equivalent to -filt=no%errors,no%names,no%returns,no%stdlib. |
If you do not specify the -filt option, or if you specify -filt without any values, then the compiler assumes -filt=%all.
The following examples show the effects of compiling this code with the -filt option.
// filt_demo.cc class type { public: virtual ~type(); // no definition provided }; int main() { type t; } |
When you compile the code without the -filt option, the compiler assumes -filt=errors,names,returns,stdlib and displays the standard output.
example% CC filt_demo.cc Undefined first referenced symbol in file type::~type() filt_demo.o type::__vtbl filt_demo.o [Hint: try checking whether the first non-inlined, non-pure virtual function of class type is defined] ld: fatal: Symbol referencing errors. No output written to a.out |
The following command suppresses the demangling of the of the C++ mangled linker names and suppresses the C++ explanations of linker errors.
example% CC -filt=no%names,no%errors filt_demo.cc Undefined first referenced symbol in file __1cEtype2T6M_v_ filt_demo.o __1cEtypeG__vtbl_ filt_demo.o ld: fatal: Symbol referencing errors. No output written to a.out |
Now consider this code:
#include <string> #include <list> int main() { std::list<int> l; std::string s(l); // error here } |
Here’s the output when you specify -filt=no%stdlib:
Error: Cannot use std::list<int, std::allocator<int>> to initialize std::basic_string<char, std::char_traits<char>, std::allocator<char>>. |
Here’s the output when you specify -filt=stdlib:
Error: Cannot use std::list<int> to initialize std::string . |
When you specify no%names, neither returns nor no%returns has an effect. That is, the following options are equivalent:
-filt=no%names
-filt=no%names,no%returns
-filt=no%names,returns