# windows qt protobuf - 選擇Go open source版本  - 下載線上安裝器  - 現在要先辦理一個帳號  - 選擇等等自行選擇安裝環境  - 把 LTS 跟 Archive 打勾 並選擇您自己所需的版本 此處以6.1.2做為示範  - 漫長的等待  - 安裝成功 - 到 [protobuf github](https://github.com/protocolbuffers/protobuf/releases) 下載最新版本protobuf-cpp-X.XX.X.zip -  - 解壓縮之後會看到一個這個資料夾 -  - 使用 QT 開啟 Protobuf 的專案內的cmake/cmakelist.txt -  - 選擇一個 MinGW 做編譯 -  - 開始編譯此專案 -  - 記得切換至 release -  - 在編譯前有幾個設定要做修正 需先在建置設定中更改 (記得要勾選 Advanced) - 將 protobuf_BUILD_TESTS 取消勾選 - 將 protobuf_BUILD_SHARED_LIBS 勾選 - 更改完畢後 記得按下 Apply Configuration Changes 之後就可開始編譯 -  - 如果看到這個畫面失敗,代表要關閉 TEST 步驟 -  - 之後編譯完成後 -  - 剛剛的資料夾中會多一個 build-cmake-Desktop_Qt_X_X_X_MinGW_64_bit-Release 的資料夾 -  - 安裝 CHOCOLATEY - 到 [CHOCOLATEY](https://chocolatey.org/install)官網安裝 照步驟安裝 -  - 使用 choco install protoc (記得使用管理員權限) -  - 接下來要將編譯完成的內容複製進系統的編譯環境中 -  - 首先要轉移 lib 檔案有以下 -  - 複製以上檔案到 QT 的安裝資料夾中的 {QT版本}/mingw81_64/lib 中 - 以本網站範例,位置為 C:\Qt\6.1.2\mingw81_64\lib -  - 接下來轉移 protobuf 的所需的檔案 - 回到 protobuf 的原始碼專案中,進去 src 資料夾 -  - 直接複製內部的 google 這整個資料夾 -  - 複製到 QT 的安裝資料夾中的 {QT版本}/mingw81_64/include 中 - 以本網站範例,位置為 C:\Qt\6.1.2\mingw81_64\include - 之後在開發 protobuf 專案時,需再您的專案中的 CMakeList.txt 中 加入此行 ``` c include_directories(${Protobuf_INCLUDE_DIRS}) ``` -  - 之後就可以開始在 windows 的 QT 上使用 Protobuf 了
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up