當前位置:首頁 » 編程軟體 » boost編譯

boost編譯

發布時間: 2022-01-08 20:58:52

『壹』 為什麼沒有編譯 boost

1、用它帶的booststrap腳本生成b2、bjam
2、用b2、bjam生成lib
boost附帶的文檔一開始就是教你怎麼安裝編譯boost。照著做就是了!

『貳』 boost 在gcc 4.8環境完整編譯出來後有多大

「完整」不知道,因為你用complete方式編譯的話,它會連那些測試用例文件一起編譯了。速度超——————超級慢。好幾個小時要吧。總覺得干這種事很蛋疼……

如果只是編譯庫(lib,.a)的話,速度要快不少,指定debug或者release的話更快。

只是庫我記得編譯好以後它文件夾就有一兩個G了。gcc編譯出來的lib又比vc出來的更大,我這里VC出來1個G(包括編譯過程中生成的obj文件和編譯後生成的dll和lib,包含debug和release),我猜測備好2G空間是基本的。complete下,它不會再重新編譯這些庫,而是只是和主程序鏈接。總之猜測2.5個G到3個G

『叄』 boost怎麼編譯

1、用它帶的booststrap腳本生成b2、bjam
2、用b2、bjam生成lib

boost附帶的文檔一開始就是教你怎麼安裝編譯boost。照著做就是了

『肆』 boost庫asio下的例子如何編譯啊

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

#define PORT 8888

void *yourfunction(void *connect_fd)
{
int connfd = *((int *)connect_fd);
。。。。
} //你沒說具體的應用,所以只能寫這么多了。在這裡面直接對connfd調用read和write函數就可以和客戶端收發數據了。

//補充:是啊 返回給客戶端什麼信息啊?

int main(void)
{
int sockfd, n, connfd;
pthread_t tid;
struct sockaddr_in servaddr;

sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd == -1)
{
perror("socket:");
exit(1);
}

bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(PORT);

n = bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
if (n == -1)
{
perror("bind:");
exit(1);
}

n = listen(sockfd, 20);
if (n == -1)
{
perror("listen:");
exit(1);
}

while (1)
{
connfd = accept(sockfd, (struct sockaddr *)&servaddr, NULL);
pthread_create(&tid, NULL, yourfunction, (void *)&connfd);
}

return 0;
}

『伍』 如何編譯boost linux

linux平台下要編譯安裝除gcc和gcc-c++之外,還需要兩個開發庫:bzip2-devel 和python-devel,因此在安裝前應該先保證這兩個庫已經安裝:
#yum install gcc gcc-c++ bzip2 bzip2-devel bzip2-libs python-devel -y
然後是去官網下載源碼包,按照如下步驟:
#tar xvzf boost_1_50_0.tar.gz
進入boost_1_50_0目錄:
#cd boost_1_50_0
然後是編譯安裝,boost源碼包中有配置腳本,直接用就可以:
#sh ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86_64/b2
Detecting Python version... 2.6
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html
- Boost.Build documentation:
http://www.boost.org/boost-build2/doc/html/index.html
接下來就是編譯,重點關注是否編譯成功:
#./b2

『陸』 如何編譯boost.1.60庫

64位windows平台,編譯環境是VS2005,進入Visual Studio 2005 x64 Win64 Command Prompt(單純的cmd也不一定不行,我沒試)。把bjam.exe放在boost根目錄下,進入根目錄,執行:
bjam --toolset=msvc address-model=64 --with-thread stage
bjam --toolset=msvc address-model=64 --with-date_time stage
關鍵選項:「address-model=64 」
64位Linux平台,使用gcc編譯。進入boost根目錄,執行:
./bjam --toolset=gcc --with-thread stage
./bjam --toolset=gcc --with-date_time stage
linux平台下倒是簡單,不過網上有篇文章介紹用如下命令編譯,不知道是多此一舉,還是適用於某些情況(非64位linux主機?)。
./bjam --toolset=gcc "-sBUILD=release <cxxflags>-m64" --with-thread stage
./bjam --toolset=gcc "-sBUILD=release <cxxflags>-m64" --with-date_time stage

唉。命令都很簡單,可浪費了我不少時間。usage根本沒寫,去看boost build的嘛,頁數n多不說,看完之後能否找到答案還是未知數。網上相關資料很少而且大多南轅北轍,只好一直搜索+嘗試。其實我只是想要個64位版本的庫而已,這應該不是啥稀罕的需求吧?
在windows平台下,編譯出來的是否是64位類庫,只有link 64位程序的時候才能發現。如果不是,link程序無法找到類庫中定義的函數或者類。linux不知道,因為我整出來直接就是64位了,我也懶得再找一台32位linux主機折騰了。
在1.37之後的boost,如果想要使用boost::thread庫,必須有boost::date_time庫。當然這件事情又一如既往很酷地沒有出現在容易看到的地方。而是讓你鏈接錯誤後再去玩抓蟲游戲。

『柒』 Linux下G++怎麼編譯使用Boost庫的程序

首先把Boost庫的頭文件存放到/usr/include/boost/路徑下,再把Lib文件存放到/usr/local/lib/boost/路徑下。修改/etc/profile文件,在此文件中增加如下2個環境變數:

BOOST_INCLUDE=/usr/include/boost
export BOOST_INCLUDE

BOOST_LIB=/usr/local/lib/boost
export BOOST_LIB

寫一個如下所示的cpp文件。
//samlpe.cpp
#include <iostream>
#include <string>
#include <boost/thread.hpp>

using namespace std;

void threadRoutine(void)
{
boost::xtime time;
time.nsec = 0;
time.sec = 20;
cout << "線程函數做一些事情" << endl;
boost::thread::sleep(time);
}

int main(void)
{
string str;
cout << "輸入任意字元開始創建一個線程..." << endl;
cin >> str;
boost::thread t(&threadRoutine);
t.join();
cout << "輸入任意字元結束運行..." << endl;
cin >> str;
return 0;
}

保存。使用g++編譯,命令如下所示:

g++ -o samlpe.out samlpe.cpp -I$BOOST_INCLUDE -L$BOOST_LIB -lboost_thread-gcc-mt

其中-I參數指定Boost頭文件路徑,-L參數指定Boost庫文件路徑,-l參數指定使用線程庫名。在我使用的這個版本Boost里,到/usr/local/lib/boost路徑下,可以看到有關Boost線程庫文件,比如:libboost_thread-gcc-mt.a等。注意在用-l參數指定庫名時把磁碟文件名前面那個lib前綴去掉就可以了。

『捌』 為什麼boost需要編譯的庫這么坑爹

,
2, 本編譯程序同操作系統能使用目標系統重新編譯源代碼應該boost庫種用文件式實現沒依賴性實現庫需要目標系統安裝相應庫文件才程序鏈接
3編寫源代碼編譯器編譯目標文件鏈接器鏈接執行文件VS傻瓜軟體隱藏細節問題找

『玖』 如何使用VS2017編譯boost

Based on KindDragons answer I compiled Boost 1.63. For 64bit. Starting with Developer Command Prompt for VS 2017 RC

Run: bootstrap.bat

open project-config.jam Here is mine:

import option ;

using msvc : 14.0 : "c:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.10.24728\bin\HostX64\x64\cl.exe";

option.set keep-going : false ;

Run b2 toolset=msvc-14.0 address-model=64

熱點內容
json格式php 發布:2024-09-21 11:08:02 瀏覽:245
sql文件用什麼打開文件 發布:2024-09-21 10:58:22 瀏覽:819
直接看腳本 發布:2024-09-21 10:55:30 瀏覽:511
c語言語句有 發布:2024-09-21 10:47:53 瀏覽:561
oracle存儲過程定義變數 發布:2024-09-21 10:30:42 瀏覽:382
預編譯的作用 發布:2024-09-21 10:24:48 瀏覽:590
網頁的訪問量 發布:2024-09-21 10:14:46 瀏覽:146
壓縮機阻 發布:2024-09-21 10:12:00 瀏覽:649
du查看文件夾大小 發布:2024-09-21 10:02:00 瀏覽:986
servuftpserver 發布:2024-09-21 09:58:51 瀏覽:387