ps:移植步驟:
2. 開啟mingw ,最好是就用qt 自帶的,我這裡開啟的是qt5.12.6(mingw 7.3.0 32-bit.如下圖;
3. 在命令列cd 到 boost_1_66_0/tools/build/src/engine
4. 執行 build.bat gcc,在當前目錄將會生成bin.ntx86資料夾,裡面包含兩個exe檔案b2.exe,bjam.exe
5. 將bin.ntx86\bjam.exe拷貝到 boost_1_66_0(該目錄根據自己的情況修改) 覆蓋原來的檔案
6. cd 到 boost_1_66_0 目錄下
7. 執行命令 bjam "toolset=gcc" install,執行命令會在c盤根目錄下生成乙個boost資料夾。最終經過漫長的編譯會在該檔案生成如下的標頭檔案與lib。
8. 將 7 中生成的 boost 裡的 boost資料夾拷貝到你需要的地方,(可以是qt 的include下面例如f:\qt592\5.9.2\mingw53_32\include)
9. 將7 中生成的 boost 裡的 lib下.a檔案拷貝到你需要的地方,(例如 qt lib目錄下 f:\qt592\5.9.2\mingw53_32\lib)
我是分別將7中的boost 資料夾和lib資料夾拷貝到我要用工程的外層資料夾如下圖的1和2。
10. 使用。 在你需要用boost的庫的***.pro中新增 include 和lib (如果你把頭檔案放在了qt 的目錄下面,就只需要新增lib連線庫了。)
我的pro 鏈結如下
11. 下面是我的測試程式:
#ifndef mainwindow_h
#define mainwindow_h
#include qt_begin_namespace
namespace ui
qt_end_namespace
class mainwindow : public qmainwindow
;#endif // mainwindow_h
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include #include using namespace std;
using namespace boost::filesystem;
mainwindow::mainwindow(qwidget *parent)
: qmainwindow(parent)
, ui(new ui::mainwindow)
mainwindow::~mainwindow()
#include "mainwindow.h"
12. 執行結果: MinGW編譯dll並引用
記得某位神仙曾經說過 乙個專案不使用dll簡直是一場災難。滑稽 這篇文章以a b a b為範例,來介紹如何在mingw下編譯dll並引用。include using namespace std define export declspec dllexport extern c int a b int...
Qt用Mingw編譯MySQL驅動
ac os x編譯安裝mysql是件非常輕鬆的活,在windows裡卻花了很久。系統 windows qt 直接使用qt sdk安裝的,所以得手動把bin目錄設定到環境路徑下 黃色背景部分為關鍵部分 總的步驟 1.生成mingw使用的mysql的libmysql.a檔案 2.qmake生成mysql...
Qt編譯並使用MQTT
mqtt概述 mqtt message queuing telemetry transport,訊息佇列遙測傳輸協議 是一種基於發布 訂閱 publish subscribe 模式的 輕量級 通訊協議,該協議構建於tcp ip協議上,由ibm在1999年發布。mqtt最大優點在於,可以以極少的 和有...