I want to use some code like:typeid(T).name(). These code works with VS 2005 & Windows Mobile 5.0 correctly, just select "Enable Run-time type info" to "yes". But these code can not be compiled with VS 2005 & PPC 2003, I have select "Enable Run-time type info" to "yes", but it still can not be compiled.
I have look for answer in here, and found a thread
https://forums.microsoft.com/MSDN/ShowPost.aspx PostID=4883&SiteID=1. And I Included ccrtrtti.lib in the project's linker input settings (additional dependencies) , but the compile still tell me:
error LNK2019: unresolved external symbol "__declspec(dllimport) public: char const * __cdecl type_info::name(void)const " (__imp_ name@type_info@@QBAPBDXZ) referenced in function "public: void __cdecl CSimpleDatas::SimpleData::Set(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsOS<wchar_t> > > const &)" ( Set@SimpleData@CSimpleDatas@@QAAXABV $CStringT@_WV $StrTraitMFC_DLL@_WV $ChTraitsOS@_W@ATL@@@@@ATL@@@Z)
..\..\Bin\Pocket PC 2003 (ARMV4)\Debug/PublicExport.dll : fatal error LNK1120: 1 unresolved externals
Why
Note: I have success in MFC exe project, failed in MFC extension dll project.

Bug of RTTI support in VS2005 & PPC2003?
den2005
Thanks.
This is my code:
template <class T>
bool Get(T& t) const
{
if ( m_strInfo != typeid(T).name() )
{
// 出 了 型不匹配 .
ASSERT(FALSE);
return false;
}
memcpy(&t, m_pData, m_length);
return true;
}
My code is in DLL with MFC extend. It works in VC6 ever, and code has been compiled by VS2005 & WM5, but it is not work with VS2005 & PPC 2003.
scepticus
945
Thanks.
I do set the wchar_t as built type, and rebuild project again and again, but the problem is still.
Poney
GlennZarb
Ok, now I get this, you are working on a MFC extension DLL, yeah I could repro this, while I have no immediate answer for this, will find and post what may be the problem, meanwhile you can look into msdn doc on how to build MFC extension DLLs here http://msdn.microsoft.com/library/default.asp url=/library/en-us/vclib/html/_MFCNOTES_TN033.asp
Thanks,
gangadhar
Feint
I created a sample app with VS2005 and PPC 2003 as a console app and it works without any problem, below is the sample code using typeid(p).name();
if still you face problem, can you send your command line for compiler and linker to me
class Base
{
public
: virtual void SomeMethod(){
cout <<
"hello";}
};
class
Derived : public Base{
public
: int p,q,r;public
: void SomeMethod(){
cout <<
"World";}
};
int
_tmain(int argc, _TCHAR* argv[]){
Base *p;
Derived obj;
p = (Base *) &obj;
cout <<
typeid(p).name(); return 0;}
Thanks,
Gangadhar
Steve Faris
This looks like you have problem linking with MFC, there is a known issue with MFC projects using wchar_t as non built in types. Please set the project Properties/Langauge, use wchar_t as built in type and rebuild the project. If you still face errors let me know.
Thanks,
Gangadhar