wxWidgets编写控制台程序的前提是wxWidgets环境配置成功(详细见我的博客中的wxWidgets在CodeBlocks中的配置)
1.创建*.cxx文件,文件中写入C++程序
2.编写makefile文件,与.cxx文件放在同一个文件夹里,makefile文件的内容:
SRC = *.cxx
wx = E:wxWidgets-2.9.5
IncludeDir1 = ${wx}include
IncludeDir2 = ${wx}libgcc_dllmswu
LIBDIR = ${wx}libgcc_dll
LIB = wxbase295u_gcc_custom
EXE = wx.exe
all:wx.o
g++ wx.o -o ${EXE} -L${LIBDIR} -l${LIB}
del wx.o
wx.o: ${SRC}
g++ -c ${SRC} -o wx.o -I${IncludeDir1} -I${IncludeDir2}
.PHONY:clean
clean:
del wx.exe
3.在开始—>cmd命令提示符中(前提是进入自己编写代码的文件夹,比如是E:app)输入
E:app>mingw32-make
4.编写运行就ok了