Build Boost Word Library under Windows

zhaozj2021-02-08  208

Build Boost Word Library under Windows

Author: lumberman

Many of the Boost library are implemented in .HPP, you can use it directly as long as you contain a path. But there are still some need to be a target library to use, including Python, regular expression, and multi-thread libraries.

After a few days, I finally got the Boost's multi-thread library, and now I have to write it out, I hope to give some reference to the trouble.

surroundings

Below is some of my installation paths, which need to be adjusted according to the actual situation during the installation process:

Operating system: Win2000

VC6: f: / Microsoft Visual Studio / VC98

BOOST: F: / BOOST_1_27_0

Install Jam

Build Boost thread library requires a tool boost.jam. Workers must be good, and must first make a tool. Let's first look at how to install JAM.

Command Line:

F: / boost_1_27_0> set visualc = "" f: / microsoft visual studio / vc98 ""

F: / boost_1_27_0> set jam_toolset = Visualc

F: / boost_1_27_0 / tools / jam_src> nmake -f bulids / win32-visualc.mk

Description:

The first is to set the environment variable Visualc and Jam_ToolSet. Two double quotes in Visualc are to identify spaces. If your VC installation path does not include a double quota: set Visualc = f: / Visual / VC98.

Then use the nmake command to be compiled. Different operating systems and different development tools correspond to different MK files in Tools / Jam_SRC / Builds / Directory.

If you use the VC7, there is a problem. Due to the use of Advapi32.lib during the compilation process, VC6 is in the VC98 / LIB / directory, and the VC7 is in PlatformSDK / LIB /, which will not find path. Since there is no careful study of Jam, I don't know where to modify this path, I have to do it myself.

If you don't want the system's environment variables to become messy, you can use the set visual = command to clear the variables.

After completing, you can see a new directory under / Tools / Build / Jam_SRC, bin.ntx86, which contains Jam.exe.

Build

Now start to create a Boost thread target library.

Command Line:

F: / boost_1_27_0> set path =% paht: ~ 0%; f: /boost_1_27_0/tools/build/jam_src/bin.ntx86

f: / boost_1_27_0> set visualc = "f: / micors ~ 1 / vc98"

f: / boost_1_27_0> jam -sboost_root =. -stools = msvc

Description:

First add the path to the Jam.exe to the PATH variable.

Then set Visualc, here, different, please note that the DOS file name is used.

Finally, execute jam, -sboost_root =. Representing the root of Boost is the current directory, -stools = MSVC indicates the tool name, which is specific, and the specific access to the Boost website query.

Build takes some time, there may be a lot of mistakes, but it is not necessary to manage him.

After completing, you will find that there are more folders, libboost_thread and libboost_threadmon, where you can find the lib files and DLL files. use

First join the path in VC:

Directories Properties page in Tools-> Option:

F: / boost_1_27_0 / libs / thread / build / bin / libboost_threadmon / msvc / release / runtime-link-dynamic / threading-multi

F: / boost_1_27_0 / libs / thread / build / bin / libboost_thread / msvc / release / runtime-link-dynamic / threading-multi

Add lib files in the project:

In Project-> Setting LINK Properties page Add to use lib: libboost_thread.lib libliboost_threadmon.lib

Define Boost_HAS_THREADS macro, otherwise there will be the following error: Thread Support is unavailable!

Select multi-line running library

In Project-> Setting-> C / C -> Code Generation Select Multithreaded DLL in the User Run-Time Library drop-down box

Ok, I can experience the new feeling of the Boost thread library.

Since I have just arrived in Boost, I still don't know very well for Boost and Jam tools. I don't dare to comment, so as not to laugh and laugh, it is just simple to list my method. If there is anything wrong, please point out.

转载请注明原文地址:https://www.9cbs.com/read-2492.html

New Post(0)