warning:cannot pass objects of non-POD type

移植代碼到Linux下,運行總是崩潰(在windows下正常)。
調試發現問題出在下列語句:
   wxString szSiteHead = wxString::Format( wxT("<Location /%s>"), file.GetName() );
查看編譯記錄有下列警告信息
   warning: cannot pass objects of non-POD type 'class wxString' through '...'; call will abort at runtime|
提示在運行時會異常。
 
查找 POD type定義如下:
 
POD stands for Plain Old Data - that is, a struct (or class) with no members except data members. Wikipedia goes into a bit more detail and defines a POD in C++ as "A Plain Old Data Structure in C++ is an aggregate class that contains only PODS as members, has no user-defined destructor, no user-defined copy assignment operator, and no nonstatic members of pointer-to-member type."
 
代碼更改後OK。
wxString szSiteHead = wxString::Format( wxT("<Location /%s>"), file.GetName().c_str() );
發佈了52 篇原創文章 · 獲贊 7 · 訪問量 15萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章