C++技巧(wxWidgets程序链接错误解决方法)
www.nanhushi.com 佚名 不详
在编译wxWidgets自带的samples时出现一个错误: CVTRES : fatal error CVT1100: duplicate resource. type:MANIFEST, name:1, language:0x0409 由于是manifest的错误,考试大提示:把这个exe的生成manifest文件的选项给关闭了,这样虽然可以解决链接错误的问题,但是在运行时出现错误,考试大提示要求使用manifest。 打开这个exe工程的rc文件看了一下,很简单的两行语句: mondrian ICON "mondrian.ico" #include "wx/msw/wx.rc" 估计问题出在wx.rc身上,打开一看,果然在其底部发现了几行代码: ////////////////////////////////////////////////////////////////////////////// // // Manifest file for Windows XP // #if !defined(wxUSE_NO_MANIFEST) || (wxUSE_NO_MANIFEST == 0) #if !defined(WX_MSC_FULL_VER) || WX_MSC_FULL_VER < 140040130 // see "about isolated applications" topic in MSDN #ifdef ISOLATION_AWARE_ENABLED #define wxMANIFEST_ID 2 #else #define wxMANIFEST_ID 1 #endif #if defined(WX_CPU_AMD64) wxMANIFEST_ID 24 "wx/msw/amd64.manifest" #elif defined(WX_CPU_IA64) wxMANIFEST_ID 24 "wx/msw/ia64.manifest" #elif defined(WX_CPU_X86) wxMANIFEST_ID 24 "wx/msw/wx.manifest" #endif #endif // !defined(WX_MSC_FULL_VER) || WX_MSC_FULL_VER < 140040130 #endif // !defined(wxUSE_NO_MANIFEST) || (wxUSE_NO_MANIFEST == 0) 直接在exe工程的rc文件选项上定义wxUSE_NO_MANIFEST,关闭wx.rc中的manifest定义,再编译运行,一切OK。