Wednesday, January 8, 2014

C++ name demangling

C++ meta-programming is great, except when you need to debug compiler errors related to templatized code.

e.g, i got the following error

duplicate symbol __ZlsRNSt3__113basic_ostreamIcNS_11char_traitsIcEEEERKN7myclass7myfunctE in file.o

What does this gobbledegook mean?

c++filt to the rescue!

c++filt __ZlsRNSt3__113basic_ostreamIcNS_11char_traitsIcEEEERKN7myclass7myfunctE

operator<<(std::__1::basic_ostream >&, myclass::myfunct const&)

so, I have a stream insertion operator that's multiply defined! On to the next clue, Watson!

No comments: