wxWidgets资源下载:https://www.wxwidgets.org/,本文使用的wxWidgets是3.0.2版本,linux为redhat6.5并安装在vmware.10虚拟机上,就以此为例:
解压:tar -jxvf wxWidgets-3.0.2.tar.bz2
进入目录:cd wxWidgets-3.0.2
配置:./configure --with-gtk --enable-unicode --disable-shared
编译:make
安装(root用户):
make install
wxwidget的头文件与库:
#wxwidget include
WXWIDGETFLAG := $(shell wx-config --cxxflags)
#wxwidget lib
WXWIDGETLIB := $(shell wx-config --libs)
调用示例:
PREFIXPATH := /usr/bin
CC := $(PREFIXPATH)/gcc -g
CX := $(PREFIXPATH)/g++ -g
LINKOPTION := -Wl,--allow-multiple-definition
OTHERHEADER := I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
(OTHERHEADER 还包含了本文项目本身的一些依赖目录,并非针对wxWidgets)
INCLUDEDIR = -I"$(OTHERHEADER)" ........其他头目录..........
%.o: %.c
$(CC) $(CFLAGS) $(LINKOPTION) $(WXWIDGETFLAG) $(INCLUDEDIR) -c $< -o $(OBJECT_PATH)/$(notdir $@)
%.o:%.cpp
$(CX) $(CFLAGS) $(LINKOPTION) $(WXWIDGETFLAG) $(INCLUDEDIR) -c $< -o $(OBJECT_PATH)/$(notdir $@)