如果你在Ubuntu中用CodeBlocks编译wxWidgets工程遇到类似以下错误,可以尝试本文提供的解决办法:
错误现象:
/usr/include/wx/cursor.h: In constructor 'wxBusyCursorSuspender::wxBusyCursorSuspender()':/usr/include/wx/cursor.h:65: error: 'wxIsBusy' was not declared in this scope/usr/include/wx/cursor.h:67: error: 'wxBusyCursor' has not been declared/usr/include/wx/cursor.h:67: error: 'wxSetCursor' was not declared in this scope/usr/include/wx/cursor.h: In destructor 'wxBusyCursorSuspender::~wxBusyCursorSuspender()':/usr/include/wx/cursor.h:72: error: 'wxIsBusy' was not declared in this scope/usr/include/wx/cursor.h:74: error: 'wxBusyCursor' has not been declared/usr/include/wx/cursor.h:74: error: 'wxSetCursor' was not declared in this scope/usr/include/wx/region.h: In member function 'bool wxRegionBase::Intersect(const wxRect&)':/usr/include/wx/region.h:251: error: invalid use of undefined type 'struct wxRegion'/usr/include/wx/gdicmn.h:38: error: forward declaration of 'struct wxRegion'/usr/include/wx/region.h: In member function 'bool wxRegionBase::Subtract(const wxRect&)':/usr/include/wx/region.h:256: error: invalid use of undefined type 'struct wxRegion'/usr/include/wx/gdicmn.h:38: error: forward declaration of 'struct wxRegion'/usr/include/wx/region.h: In member function 'bool wxRegionBase::Xor(const wxRect&)':/usr/include/wx/region.h:261: error: invalid use of undefined type 'struct wxRegion'/usr/include/wx/gdicmn.h:38: error: forward declaration of 'struct wxRegion'
原因分析:
如果确认你已经安装了图形UI库(如GTK),这一般是因为wx-config中的配置指向错误造成的。
解决办法:
1.确定你正常安装了CodeBlocks以及wxWidgets,可以参考以下步骤
安装基本编译环境sudo apt-get install build-essential gdb安装CodeBlockssudo apt-get install codeblocks codeblocks-dbg wxformbuilder安装wxWidgetssudo apt-get install libwxbase2.8 libwxbase2.8-dev libwxgtk2.8-0 libwxgtk2.8-dev libwxgtk2.8-dbg wx-common wx2.8-headers wx2.8-i18n
2.确认当前wxWidgets版本,选择gtk2-unicode-debug-2.8:
sudo update-alternatives –config wx-config
3.修改wx-config配置,让它指向到2上所选的正确版本gtk2-unicode-debug-2.8:
wx-config –cxxflags -I /usr/lib/wx/include/gtk2-unicode-debug-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -D__WXDEBUG__ -D__WXGTK__ -pthread
郑重声明:
除特别声明为转载内容外,本站所有内容均为作者原创,谢绝任何单位和个人不经许可的复制和转播!
对于确有转载需要的,请先与作者联系,在获得允许后烦请在转载时保留文章出处。
本文出自Lupin's Blog:http://www.cnzui.com/archives/1189
除特别声明为转载内容外,本站所有内容均为作者原创,谢绝任何单位和个人不经许可的复制和转播!
对于确有转载需要的,请先与作者联系,在获得允许后烦请在转载时保留文章出处。
本文出自Lupin's Blog:http://www.cnzui.com/archives/1189
支持博主咯
多谢啊,你的站做得很不错哦
谢谢夸奖哈
请教博主一个问题:现在在用wxWidgets开发C++程序(以前使用MFC,因为要考虑跨平台转到wxWidgets)。请问有没有类似BCG的开发包?
我没接触过BCG,不是很了解,不过如果是要找一些wxWidgets扩展库的话,推荐你在wxCode里找找看:http://wxcode.sourceforge.net/
请教博主一个问题:现在在用wxWidgets开发C 程序(以前使用MFC,因为要考虑跨平台转到wxWidgets)。请问有没有类似BCG的开发包?
收藏了
博主的网站模板不错哦,文章也很好看,不能能否互做友情链接?