[cfe-dev] RTTI Q

John McCall rjmccall at apple.com
Tue Aug 9 20:28:48 PDT 2011


On Aug 9, 2011, at 8:05 PM, Joel de Guzman wrote:
> Can anyone tell me how to make this simple code link properly on
> Windows with Clang (configured via cmake for MSVC)? I'm hoping there's
> a simple solution that I have missed.
> 
>  #include <typeinfo>
> 
>  struct x {};
> 
>  int main()
>  {
>    typeid(x).name();
>  }
> 
> I'm getting linker errors:
> 
> cc-091711.o : error LNK2019: unresolved external symbol ___type_info_root_node referenced
> in function _main
> cc-091711.o : error LNK2019: unresolved external symbol
> __ZNK9type_info4nameEP16__type_info_node referenced in function _main
> cc-091711.o : error LNK2001: unresolved external symbol __ZTVN10__cxxabiv117__class_type_infoE
> 
> with this command line:
> 
>  clang++ rtti.cpp -o rtti.exe
> 
> (Clang build using Visual Studio 10)
> 
> Does anyone know the correct runtime libs to link against to make this work?
> I am aware that exception handling is not yet implemented on Windows
> (neither MSVC nor MinWG). Is rtti support also not implemented?

MSVC-compatible RTTI is not implemented.  I know of no reason
why MinGW RTTI wouldn't work if you correctly link against the
MinGW C++ library.

John.



More information about the cfe-dev mailing list