Experience: VC .NET 2003 - Install and use Boost 1.30 and Blitz 0.6
Mood
2003-05-01
Article Type: in-depth
Difficult Level: 7/9
Version: 1.82
"C Increasingly Means Visual C " - Scott Meyers
Previous article, I introduced the case of compiling and using Stlport and Loki under the latest Visual Studio.Net 2003. Everything is going well, this article introduces the case where you install and use Boost and Blitz .
For Boost has reached the extraordinary spirit of the big name, the beginning of the beginner side, the situation of reaching out can not touch, the thick description will see Chinese-style etiquette - "a group of cattle written, must have it Places, our junior is still carefully studying! ", While the official prospects seem to be added to ISO C Standard, I think this is a definiteness to Boost, and the entire C community A big thing. For me, everyday use of Boost is very small, almost no, you know that I am a .NET fan J, in fact, the lastst Stlport and Loki are already enough. For alive for a novice, if I have done, please contact us.
First of all, it is of course going to download the latest version, although this is a well-known place and problem, www.boost.org, the latest version is 1.3.0, download it down about 10m, I decompressed to C: / boost_1_30_0
My Visual Studio.net 2003 is installed in the following path:
D: / Program Files / Microsoft Visual Studio .NET 2003 / VC7
It is then a common two steps, one is to generate a Jam.exe file, then compile the Boost library, especially the famous Thread library. You will find that many libraries of Boost are used by include, don't compile them in advance, really compile you will find that if you use these libraries, you need to compile yourself:
Date_time / filesystem / graph / python / regex / signals / test / thread
Corresponding should be Date-Time Library / File System Library / Graph Library / Python Library / Regx Library / Signals Library / Test Library / Thread Library
So it is often compiled, but it means that it is successful to compile these library files, but this does not mean Visual C . Net 7.1 fully follows Boost Library or fully uses all the features in Boost Library, this is later I will mention, you Some functions and modules will be found to compile or run different extent. Of course, this is not only VC7.1, almost all of the mainstream C compilers will have such problems, this will be mentioned later.
There is such a phenomenon in the Boost Library library, and some library files provide a MAK file. We can compile successfully or use it through nmake -f xxx.mak install, such as regex / vc7.mak; regex / vc6-stlport.mak but more The class library must be compiled by Boost.jam's build system, which is also a reason for Boost compilation difficulties. Ok, let's compile JAM first, this is a prerequisite for us to continue:
Regarding Jam, there are also pre-translated, you can take the following address, direct download, you can also choose your own way, or to verify your compiler, or make a warm-up, you will choose your own compilation. J
Before compiling, some questions require you to pay attention, mainly to install the path and compiler, here you need to view two files:
C: /boost_1_30_0/tools/build/jam_src/build.bat
C: /boost_1_30_0/tools/build/jam_src/build.jam
The problem with build.bat is the path problem:
"% Programfiles% / Microsoft Visual Studio .NET / VC7 / BIN / VCVARS32.BAT"
Batch file is based on such judgment to find VC compiler and to determine the version of your development tool, and my VC is installed in such directories D: / Program Files / Microsoft Visual Studio .NET 2003 / VC7 results will make It can't find a compiler, then you have two options, the first is to modify the path in build.bat; the second is to set the set boost_jam_toolset = VC7, set boost_jam_toolset_root =% ProgramFiles% / Microsoft Visual Studio .NET 2003 / VC7 / ;
For the problem of build.jam is the parameter problem of CL, the new version of the CL does not support / libpath: XXXX, the solution to this problem is to remove the use of this parameter in the build.jam file, and ensure that you have set it. Include and LIB environment variables, the easiest way is to perform x: / program files / Microsoft Visual Studio .NET 2003 / VC7 / BIN / VSVARS32.BAT or D: / Program Files / Microsoft Visual Studio .NET 2003 / Common7 / Tools /VSVARS32.BAT.
Use the Visual Studio.Net 2003 Command Prompt (see the previous description), if your VC7 installation path and the Boost installation file do not need to modify it, but / Libpath parameter problem general VC7.0 is also VC7.1 is to be adjusted.
After completing, you only use the C: /boost_1_30_0/tools/build/jam_src/build.bat, if you don't have any questions, you can see the results of compilation in C: /boost_1_30/tools/build/jam_src/bin.ntx86
I will compile Jam.exe and have previously modified build.bat and build.jam placed in a compressed file, you can download Build Jam Setup.zip (208K)
Ok, after the completion of this, I have finished a small paragraph. We can start moving down next steps, compiling boost library, and it is not easy to say. We also need to do some preparations before using JAM compile.
1. Place the path where Jam.exe is located in the environment variable PATH.
Execute Varvs32.bat,
SET PATH = C: /boost_1_30_0/tools/build/jam_src/bin.ntx86;% PATH%
2. Modify, then modify, this time is:
C: /boost_1_30_0/tools/build/vc7-tools.jam
C: /boost_1_30_0/tools/build/msvc-tools.jam
The main problem is still the two issues just mentioned, the path of the VC7.1 compiler and / libpath, which is not listed here, you need to view certain statements in these two files. Of course, you can Downlaod I have modified (including the build_jam_setup.zip on it), unlock the zip file is overwritten (recommended to back up the file to be overwritten)
3. You can start compiling, usually you use the following command.
PATH = C: / boost_1_30_0; c: /boost_1_30_0/tools/build/jam_src/bin.ntx86;% PATH%
SET MSVC_ROOT = "D: / Program Files / Microsoft Visual Studio .NET 2003 / VC7"
SET VC7_ROOT = "D: / Program Files / Microsoft Visual Studio .NET 2003 / VC7"
SET Visualc = "D: / Program Files / Microsoft Visual Studio .NET 2003 / VC7"
Set jam_toolset = Visualc
C: / boost_1_30_0> jam -sboost_root =. -Stools = vc7 "-sbuild = debug release
Or c: / boost_1_30_0> jam -sboost_root =. -Stools = vc7 "-sbuild = debug
There is also more interesting orders, such as:
Jam -sbuild = "debug release" -stools = "msvc msvc-stlport" -svisualc = "/" d: / program files / microsoft visual studio / vc98 / "/" "-smsvcdir =" / "/" d : / Program Files / Microsoft Visual Studio / VC98 / "/" "
This is what I saw on a Japanese website, because I used a lot of websites that I used Google, I found two Japanese websites, introduced very detailed, because of Japanese, I don't understand, but Some places to copy and code is also very helpful and inspired. I will list it, I hope to help and inspire you:
http://www.kmonos.net/alang/boost/ Let's Go Boost
Http://nazy.s27.xrea.com/boost/index.shtml nazy's developer's site Of course, you can also learn from the official website of Boost.org, I think it is somewhat scattered, sorted out.
http://www.boost.org/tools/build/build_system.htm
http://www.boost.org/tools/build/jam_src/jam.html
Some parameters of Jam.exe
a
Build All Targets, Even If They is current.
DX
Set the debug level to x (0-9)
FX
Read x instead of jambase.
JX
Run up to x shell commands concurrently.
n
On't actual execute the Updating Actions.
OX
Write the Updating Actions to File X.
Qi
Quit Quickly as soon as a target fails.
SX = Y
Set variable x = y, Overriding Environment.
TX
Rebuild X, Even if IT is Up
v
Print The Version of Jam and EXIT.
--X
Option is ignored.
Build parameters can be the following syntax
Build = {OPTION}.
Option = [[
Variable
DEFAULT
EXAMPLE
Notes
Tools
Platform-dependent
"-stools = GCC MSVC"
Build with GCC and MSVC
-stools = GCC
Build with GCC
Build
Debug
-sbuild = release
Build The Release Variant
"-sbuild = debug release"
Build Both Debug and Release Variants
"-sbuild =
Build A Subvariant of The Default Variant (Debug) with optimization for speed.
"-sbuild = debug release
BUILD SUBVARIANTS OF THE Debug and release Variants That Link to the runtime Both staticly and dynamical.
ALL_LOCATE_TARGET
EMPTY
-sall_locate_target = ~ / build
Generate All Build Results In The Build Subdirectory of the User's Home Directory.
After that, you need to wait, but this time will not be too long, it is about 25 minutes, the entire compilation is completed.
Failed in the figure, I commented on the results of Test Library, because I have compiled previous compilation, I found Test Library could not be able to compile the past. Check the above-mentioned class libraries, you will find similar paths and compile results: Special:
The Visual Studio.Net Version 7.1.2292 used herein is not the final version of Visual Studio.Net Final Bate. It does not know whether it is different from official versions.
Cl.exe Microsoft (R) 32-Bit C / C Optimizing Compiler Version 13.10.2292 for 80x86
This article original, 9CBS signature start, all text and photo copyright. Do not propagate, reprint, or adaptation without authorization.
If you have any questions or suggestions, please email new2001@msn.com
Welcome to my WebLog: www.dotnettools.org/weblog/weblog.html