在windows下用Qt Creater 编译qwt5.2.1
下载QWT的源码,这里我们下载的版本为qwt-5.2.1,然后解压到一个英文路径下。修改其主目录下的qwtconfig.pri文件(这里所做的修改主要是为了能够调试qwt程序):将
else {
# Qt 4
win32 {
# On Windows you can't mix release and debug libraries.
# The designer is built in release mode. If you like to use it
# you need a release version. For your own application development you
# might need a debug version.
# Enable debug_and_release + build_all if you want to build both.
CONFIG += release # release/debug/debug_and_release
#CONFIG += debug_and_release
#CONFIG += build_all
}
else {
CONFIG += release # release/debug
}
}
修改成为
else {
# Qt 4
win32 {
# On Windows you can't mix release and debug libraries.
# The designer is built in release mode. If you like to use it
# you need a release version. For your own application development you
# might need a debug version.
# Enable debug_and_release + build_all if you want to build both.
#CONFIG += release # release/debug/debug_and_release
#CONFIG += debug_and_release
CONFIG += build_all
}
else {
CONFIG += release # release/debug
}
}
使用QT Creator打开解压后的qwt.pro工程文件,点击编译按钮,让QT Creator完成所有的工作。
编译完成后,将源码目录下的qwtd5.dll,qwt5.dll(在qwt-5.2.1/lib)拷到QT SDK的bin目录下(在C:/Qt/2010.02.1/qt/bin),将相应的libqwtd5.a,libqwt5.a拷到lib目录下(在C:/Qt/2010.02.1/qt/lib)。最后将源码(qwt-5.2.1/designer/plugins/designer)目录中libqwt_designer_plugind5.a文件和qwt_designer_plugind5.dll和libqwt_designer_plugin5.a文件和qwt_designer_plugin5.dll文件拷到QT SDK的designer目录下(在C:/Qt/2010.02.1/qt/plugins/designer)。
自己在C:/Qt/2010.02.1/qt/include目录下创建一个文件夹qwt, 将源码src目录下的(在qwt-5.2.1/src)所有*.h文件拷到这个文件夹中。
当创建使用QWT库的QT程序时,将下面两句话添加到.pro文件中:
LIBS += -L”C:/Qt/2010.02.1/qt/lib” -lqwtd5
INCLUDEPATH += C:/Qt/2010.02.1/qt/include/qwt
但是这时我们还不能在QT Designer中看到qwt部件,这时由于先前下载的QT Creator是用MSVC编译的,所以我们需要重新下载一个QT Creator的源码包,用现有的QT Creator将其编译,以后我们使用编译过的QT Creator即可。
接下来还会在linux下编译和QTE平台下去编译。