用qt creator 開發 wxwidgets 應用程序

一、下載安裝包wxWidgets-suite_setup.exe,http://pan.baidu.com/s/1jG3fAOQ  ,已經集成 qt creator、mingw32 及wxwidgets 3.0.1的靜態庫(g++和vc2010編譯兩種)。html

wps_clip_image-32644

二、安裝它,注意安裝路徑不要有空格,不然到後面用mingw32編譯工程的時候會報錯。c++

wps_clip_image-24929

wps_clip_image-28161

wps_clip_image-20522

三、安裝完畢後,點「開始」->「wxWidgets-suite」-> wxWidgets-suite.bat 打開 qt creator 開發環境,並配置mingw32編譯工具。web

wps_clip_image-30085

wps_clip_image-13855

wps_clip_image-26049

wps_clip_image-14390

四、打開項目模板,點「開始」->「wxWidgets-suite」-> wxDemo-qt項目模板.rar 解壓到一個目錄下,注意路徑不能有空格。用qt creator 打開其中的project.pro 項目文件。編譯該工程,運行之。Enjoy ! :)shell

wps_clip_image-15288

wps_clip_image-32647

wps_clip_image-2909

wps_clip_image-13257

五、調試代碼。在debug模式下,點「開始調試」(F5),api

wps_clip_image-11818

wps_clip_image-7631

wps_clip_image-17782

六、最後看下項目工程(.pro)文件,這個要求對qmake有所瞭解。app

#########################################################################工具

##includeui

WXWIN= $$[QT_INSTALL_PREFIX]/wxWidgets-3.0.1-rel-staticdebug

win32-g++:{調試

WXCFG=gcc_lib/mswud

}

win32-msvc*:{

WXCFG=vc_lib/mswu

}

INCLUDEPATH += $$WXWIN/lib/$$WXCFG \

$$WXWIN/include

DEPENDPATH += $$WXWIN/lib/$$WXCFG \

$$WXWIN/include

#資源文件包含路徑

RC_INCLUDEPATH += $$WXWIN/include

#########################################################################

##LIBS

win32-g++:{

#4

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_propgrid.a

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_aui.a

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_xrc.a

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_richtext.a

#3

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_gl.a

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_media.a

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_ribbon.a

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_stc.a

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_webview.a

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_adv.a

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_html.a

LIBS += $$WXWIN/lib/gcc_lib/libwxbase30ud_xml.a

#2

LIBS += $$WXWIN/lib/gcc_lib/libwxmsw30ud_core.a

LIBS += $$WXWIN/lib/gcc_lib/libwxbase30ud_net.a

#1

LIBS += $$WXWIN/lib/gcc_lib/libwxbase30ud.a

#0

LIBS += $$WXWIN/lib/gcc_lib/libwxregexud.a

LIBS += $$WXWIN/lib/gcc_lib/libwxscintillad.a

LIBS += $$WXWIN/lib/gcc_lib/libwxexpatd.a

LIBS += $$WXWIN/lib/gcc_lib/libwxjpegd.a

LIBS += $$WXWIN/lib/gcc_lib/libwxpngd.a

LIBS += $$WXWIN/lib/gcc_lib/libwxtiffd.a

LIBS += $$WXWIN/lib/gcc_lib/libwxzlibd.a

##mingw_path

mingw_path= $$[QT_INSTALL_PREFIX]/mingw482r4/i686-w64-mingw32/lib

LIBS += $$mingw_path/libkernel32.a \

$$mingw_path/libuser32.a \

$$mingw_path/libgdi32.a \

$$mingw_path/libwinspool.a \

$$mingw_path/libcomdlg32.a \

$$mingw_path/libadvapi32.a \

$$mingw_path/libshell32.a \

$$mingw_path/libole32.a \

$$mingw_path/liboleaut32.a \

$$mingw_path/libuuid.a \

$$mingw_path/libcomctl32.a \

$$mingw_path/libwsock32.a \

$$mingw_path/libodbc32.a

}

win32-msvc*:{

#4

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_propgrid.lib

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_aui.lib

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_xrc.lib

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_richtext.lib

#3

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_gl.lib

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_media.lib

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_ribbon.lib

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_stc.lib

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_webview.lib

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_adv.lib

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_html.lib

LIBS += $$WXWIN/lib/vc_lib/wxbase30u_xml.lib

#2

LIBS += $$WXWIN/lib/vc_lib/wxmsw30u_core.lib

LIBS += $$WXWIN/lib/vc_lib/wxbase30u_net.lib

#1

LIBS += $$WXWIN/lib/vc_lib/wxbase30u.lib

#0

LIBS += $$WXWIN/lib/vc_lib/wxregexu.lib

LIBS += $$WXWIN/lib/vc_lib/wxscintilla.lib

LIBS += $$WXWIN/lib/vc_lib/wxexpat.lib

LIBS += $$WXWIN/lib/vc_lib/wxjpeg.lib

LIBS += $$WXWIN/lib/vc_lib/wxpng.lib

LIBS += $$WXWIN/lib/vc_lib/wxtiff.lib

LIBS += $$WXWIN/lib/vc_lib/wxzlib.lib

##vc

LIBS += winmm.lib \

rpcrt4.lib \

kernel32.lib \

user32.lib \

gdi32.lib \

winspool.lib \

comdlg32.lib \

advapi32.lib \

shell32.lib \

ole32.lib \

oleaut32.lib \

uuid.lib \

comctl32.lib \

wsock32.lib \

odbc32.lib \

LIBCMT.lib

}

#########################################################################

##CONFIG

win32-g++:{

CONFIG(debug, debug|release){

QMAKE_CXXFLAGS_DEBUG += -O0 -g

QMAKE_CFLAGS_DEBUG += -O0 -g

QMAKE_LFLAGS_DEBUG +=-static-libgcc -static-libstdc++ -static

}

CONFIG(release, debug|release){

#QMAKE_CXXFLAGS_RELEASE += -O0 -g

#QMAKE_CFLAGS_RELEASE += -O0 -g

QMAKE_LFLAGS_RELEASE =-static-libgcc -static-libstdc++ -static

#去掉調試信息

QMAKE_LFLAGS_RELEASE += -s

}

}

win32-msvc*:{

CONFIG(debug, debug|release){

QMAKE_LFLAGS_DEBUG = /DEBUG /NODEFAULTLIB:MSVCRT.lib /NODEFAULTLIB:msvcprt.lib /NODEFAULTLIB:MSVCRTd.lib /NODEFAULTLIB:msvcprtd.lib

QMAKE_CXXFLAGS_DEBUG = /Zi /Od

}

CONFIG(release, debug|release){

QMAKE_LFLAGS_RELEASE += /NODEFAULTLIB:MSVCRT.lib /NODEFAULTLIB:msvcprt.lib /NODEFAULTLIB:MSVCRTd.lib /NODEFAULTLIB:msvcprtd.lib

}

}

#wxCXXFLAGS = $$system(wx-config --prefix=D:\wxWidgets-3.0.1-rel-static --wxcfg=gcc_lib\mswud --unicode=yes --debug=yes --static=yes)

#wxLinkOptions = $$system(wx-config --prefix=D:\wxWidgets-3.0.1-rel-static --wxcfg=gcc_lib\mswud --unicode=yes --debug=yes --static=yes)

wxCXXFLAGS = $$system(wx-config --prefix=$$WXWIN --wxcfg=$$WXCFG --unicode=yes --static=yes)

wxLinkOptions = $$system(wx-config --prefix=$$WXWIN --wxcfg=$$WXCFG --unicode=yes --static=yes)

LIBS += $$wxLinkOptions

QMAKE_CXXFLAGS_RELEASE += $$wxCXXFLAGS

#########################################################################

#########################################################################

TEMPLATE = app

CONFIG -= console

CONFIG -= app_bundle

CONFIG -= qt

SOURCES += GUIFrame.cpp \

wxDemo_qtApp.cpp \

wxDemo_qtMain.cpp

HEADERS += GUIFrame.h \

wxDemo_qtApp.h \

wxDemo_qtMain.h

OTHER_FILES += WxWizFrame.fbp \

resource.rc

RC_FILE = resource.rc

相關文章
相關標籤/搜索