Compile, install Boost (on Windows and Solaris)

xiaoxiao2021-03-06  14

David: This is the note when I study Boost, and I recently saw someone in the forum, so I was posted and shared. In fact, personal believes that Boost is still not suitable for application development. After all, Boost Takai is too big (of course, you can only use some), but the maintenanceability of the program is always a problem, unless you want to explore C research frontier Meta Programming This generic programing is the magical world. It is highly recommended that BOOST's researchers have studied a small template library to LOKI before studying Boost, and many technologies in Boost makes you uninhabilized in the Loki library, and the author of this library specializes in MODERN C Design. To explain the implementation of the library. In addition, if you want to study Boost, don't compile all libraries, such as Python, Thread, Test, because you spend a few hours compiled, you may find that you don't use these libraries at all, or to it I am not interested in it. When you study a small number of libraries, it is not too late to compile the Boost.

Note: 1. Please confirm that you have installed the appropriate compiler in your OS before the start. The following Windows Environment takes Windows 2000 VC6 as an example. In the UNIX environment, Solaris 9 GCC 3.4.2 is an example; 2, below $ Boostdir represents the storage directory of the Boost, please modify it according to the actual situation.

O, download unpacking (omitted)

First, compile jam1.windows to $ boostdir / tools / build / jam_src to perform build.bat to compile JAM, compile the results, will be stored under $ boostdir / tools / build / jam_src / bin.ntx86. If you encounter problems during the execution of the batch, if the report cannot find a compiler-related program, perform X: / Program Files / Microsoft Visual Studio / VC98 / BIN / VCVARS32.BAT to establish a basic environment variable of the VC. 2. Solaris 9 to $ boostdir / Tools / Build / Jam_src execute ./build.sh compiles JAM, compile results will be stored under $ boostdir / tools / build / jam_src / bin.solarisx86.

Second, set the environment variable (Note: This step can be omitted, directly through -s in (3) to the command line, but the setting can make the command line clearer, simple.) 1.Windows My computer point Right-click -> Properties -> Advanced -> Environment Variables -> User Variable or System Variable: PATH Last Add BJAM Storage Directory, such as: $ boostdir / tools / build / jam_src / bin.ntx86 New Environment variable MSVCDir, and in variable Fill in the VC installation directory in the column, such as: x: / program files / microsoft Visual Studio / VC98 new environment variable: python_root = x: / program files / python2.3.4python_version = 2.32. Solaris 9 Addition in .profile Compiled JAM's storage directory. And add python_version = 2.3export python_version, do not need to set python_root, Solaris will automatically process.

Third, compile 1.Windows to $ boostdir, execute the following command: jam -sboost_root =. -Stools = msvc "-sbuild = debug release static / Dynamic" The above command is explained below: -s 即 set, set the environment Variables; Boost_Root Boost's storage directory Tools you choose ToolSet, such as GCC, MSVC (ie VC6), VC7.1, and GCC-Stlport, MSVC-Stlport, VC7.1-Stlport, indicating simultaneous use of Stlport. What Toolset, which is specifically supported, you can look at $ boostdir / tools / build / v1. Build Compilation Type, the above option represents the Debug and Release version (4 versions) supporting Static and Dynamic links. Compiled lib, DLL will be subjected to Copy to $ Boostdir / Bin / Boost / Libs Directory, but these libs, DLLs are dispersed in different directories. For ease of use, they can look for * .lib and * in the above directory. DLL identifies these files, then all copies all Copy to VC's lib directory and Windows's System32 directory, you can also create a directory specifically to store Boost lib files, then select Tools-> Options-> Directories- > Library files, add the above directory path to the VC environment settings. 2. Solaris 9 to $ boostdir Perform the following command: jam -sboost_root =. -Stools = gcc "-sbuild = debug release static / dynamic" But it is recommended to use the following command: jam -sboost_root =. -Stools = GCC "-sbuild = release Dynamic Speed" This can greatly speed up the speed of compilation, and individuals think that Boost is large, it is best to use dynamic links to reduce the Size of the target program. Just like libstdc , there have been some people have seen someone to static link libstdc . A, although this static library is provided in the system.

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

New Post(0)