網(wǎng)站首頁 編程語言 正文
在win端如果使用非VS編譯器,則需要使用Boost.Build來創(chuàng)建自己的二進(jìn)制文件。
本文,主要記錄win系統(tǒng)用MinGW編譯Boost庫的過程。
1、下載
boost下載并解壓縮,下載鏈接:https://www.boost.org/users/history/
2、編譯鏈接庫
1)創(chuàng)建三個(gè)獨(dú)立文件夾
#后期可以刪除,安裝Boost.Build
mkdir D:\boost_build
#后期可以刪除,存放
mkdir D:\boost_1_76_0\build
#后期不可刪除,存放庫文件的
mkdir D:\boost
2)安裝Boost.Build
cd D:\boost_1_76_0\tools\build
bootstrap.bat gcc
b2 install --prefix="D:\boost_build" --toolset=gcc
3)編譯鏈接庫
先將cd D:\boost_1_76_0\
cd D:\boost_1_76_0\
b2 --build-dir="D:\boost_1_76_0\build" --prefix="D:\boost" --toolset=gcc --build-type=complete stage
4) 刪除
編譯完成后,可以把D:\boost_build和D:\boost_1_76_0\build兩個(gè)目錄刪掉,最終的boost庫安裝在D:\boost下面
3、鏈接庫測試
gcc -I"D:\boost\include\boost-1_76" -L"D:\boost\lib"
INCLUDE += D:\process\boost_1_77_0
LIB += D:\process\boost_1_77_0\stage\lib
測試代碼:
#include <iostream>
#include <string>
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
using namespace boost;
void helloA()
{
std::cout << "I'm thread A ! --- Start " << std::endl;
sleep(10);
std::cout << "I'm thread A ! --- OVER " << std::endl;
}
void helloB()
{
std::cout << "I'm thread B ! --- Start " << std::endl;
sleep(10);
std::cout << "I'm thread B ! --- OVER " << std::endl;
}
int main(int argc, char *argv[])
{
std::cout << "Hello world!" << std::endl;
boost::thread thrdA(&helloA);
boost::thread thrdB(&helloB);
thrdA.join();
thrdB.join();
}
總結(jié)
原文鏈接:https://blog.csdn.net/zeye5731/article/details/127380251
相關(guān)推薦
- 2022-05-11 JVM內(nèi)存模型深度剖析與優(yōu)化
- 2022-12-10 MongoDB中的push操作詳解(將文檔插入到數(shù)組)_MongoDB
- 2022-06-14 教你使用docker查看運(yùn)行中的容器_docker
- 2022-09-20 Python處理時(shí)間戳和時(shí)間計(jì)算等的腳本分享_python
- 2022-07-16 如何編譯omx-bellagio以及ffmpeg插件
- 2022-07-24 .Net結(jié)構(gòu)型設(shè)計(jì)模式之裝飾模式(Decorator)_基礎(chǔ)應(yīng)用
- 2023-05-06 Flutter學(xué)習(xí)之SliverList和SliverGird的使用詳解_Android
- 2022-08-30 cvc-complex-type.2.4.a: 發(fā)現(xiàn)了以元素 ‘base-extension‘ 開頭
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支