STL is a standard, and each business has developed its STL version based on this standard. In this STL version in this shape, SGI STL is undoubtedly the most eye-catching one. This is of course because this STL product is famous, its design and writer list, Alexander Stepanov and Matt Austern, there are two masters to sit in the town, and their code level has the highest guarantee. SGI STL is not only in efficiency, but also in accordance with ISO C standards, users are askoruses. In addition, SGI STL achieves Thread-Safe, also adds several components to users, such as Hash, Hash_Map, Hash_MultiMap, Slist, and Rope containers, and more. Therefore, in learning or practical, SGI STL should be preferred.
Helpless, SGI STL is essentially tailored to SGI's own Unix variant IRIX, and the C compiler on other platforms wants to use SGI STL. Although the famous GNU C also uses SGI STL, it has been commissioned before issuance. Ordinary users, especially BCB / VC users on the Windows platform, want to work together with SGI STL, but not something. Fortunately, the Hero always appears in time, Russian Boris Fomitchev pays after this issue, established a Free project, called Stlport, aimed to transplant the basic code of STL to various mainstream compilation environments, so that various compilation Users can enjoy the advanced from SGI STL. During the development of STLPORT, it has been affected by Matt Austern, and it has been mature today. The latest STLPORT 4.0, can be downloaded from www.stlport.org, the zip file volume is approximately 1.2m, which can support transplantation to various mainstream C compilation. BCB and VC are of course considered a mainstream compilation environment, naturally get the care of STLPORT. However, according to the practice, there are still some obstacles to the configuration, this article is intended to guide the reader to configure STLPORT in the Borland C Builder 5.5 and Visual C 6.0 environments.
First, please download the ZIP files of Stlport 4.0 from www.stlport.org, filename stlport-4.0.zip. Then use Winzip and other tools to expand. Generate a STLPORT-4.0 directory, there are only one subdirectory, name is also stlport-4.0, you might want to copy the whole directory to you to think the right location, then change a suitable name, such as cooperating with BCB, can be called STL4BC, and so on.
The following is divided into two cases of BCB / VC to describe the specific process.
Borland C Builder 5borland C compiler is 5.5, in the currently mainstream Windows platform compiler, support for ISO C Standard is the most complete. Use it to match the SGI STL quite convenient, and the recommendation of the author. Without this development tool, you can download a hardcover version of the Borland C 5.5 compiler to www.borland.com, which is 8.54m, name freecommandlinetools1.exe, is a self-extracting installation file. It can be executed in Windows and install it into the appropriate directory. After the expansion volume is 50m.
In the following description, assume that the Windows you use is in the C: / Windows directory. If you have BCB5, I assume that it is installed in C: / Program Files / Borland / CBuilder5; if you don't have BCB5, but use the above-mentioned Lite BCC, assume that it is installed in the C: / BCC55 directory, and the Stlport original package is placed C: / STL4BC. C: / STL4BC should have the following:
Make sure C: / Program Files / Borland / CBuilder5 / BIN or C: / BCC55 / BIN is in your PATH environment variable.
The author recommended that you read the install file before installation, which will talk about how to avoid using the Iostream library provided by SGI. If you don't want to use SGI iostream, Stlport will add a Wrapper outside the iostream library that comes with the original compiler, making it cooperate with SGI STL. However, the Iostream library is good at the Iostream library, and the speed is also fast, so the author doesn't think about any reason, it is assumed to use the author, and it is willing to use the SGI Iostream library. Different viewers are adjusted according to the install file.
Next step:
0. This configuration task is completed in the DOS command state, first select the MS-DOS mode from the "Start" -> "Attachment" menu, open a DOS window.
1. In C: / Program Files / Borland / CBuilder5 / bin, use your handful text editor to modify two files:
File1: bcc32.cfg, modulated:
-I "C: / STL4BC / STLPORT"; / "c: / program files / borland / cbuilder5 / include"; / "c: / program files / borland / c: / number / vCl" -l "C: / STL4BC / LIB "; /" c: / program files / borland / cbuilder5 / lib "; /" c: / program files / borland / c: / program files / borland / cbuilder5 / lib / release "
In order to facilitate reading "/" symbol, the actual file should only have two lines.
File2: ILINK32.CFG, modulated:
-L "C: / STL4BC / LIB"; / "c: / program files / borland / cbuilder5 / lib"; / "c: / program files / borland / cbuilder5 / lib / OBJ"; / "C: / Program Files / Borland / cbuilder5 / lib / transase
In the C: / BCC55 / BIN directory, there is no two files, please use the text editor to manually make these two documents, the content is different from above, as follows
File1: bcc32.cfg, content:
-I "c: / STL4BC / STLPORT"; "C: / BCC55 / INCLUDE"; - L "C: / STL4BC / LIB"; "C: / BCC55 / LIB";
File2: ILINK32.CFG, content: -l "C: / STL4BC / LIB"; "C: / BCC55 / LIB";
2. Go to the C: / STL4BC / SRC directory.
3. Execute the command Copy BCB5.mak Makefile
4. Run Make Clean All
This command will perform for a long time, especially on the old machine, may run more than 30 minutes. The screen is constantly displaying
Work situation, sometimes you will see that the computer is doing the same a few things in repeatedly, please keep patient, this is actually
Establish different nature target libraries with different compilation switches.
5. After a long compilation, finally ended. Now you will execute the command made Make Install is not long.
6. Come to the C: / STL4BC / LIB directory, execute a copy * .dll C: / Windows / System;
7. OK, very successful. The following step should be to check that there is not really the SGI STL. ROPE is a unique container provided by SGI STL to deal with a large-scale string (String is a string, and ROPE is a crude rope, you can want to see ROPE's ability to have more powerful).
Below this program is a bit violent, but you can also do a small trial:
//issgistl.cpp#include
Using namespace std;
INT main () {// crope is the Rope container CROPE BIGSTR1 ("TO PLUG THE Stlport Into Borland C ); CROPESTR2 (" To Plug The Stlport Into Borland C ); CROPE = BIGSTR1 BIGSTR2 COUT << story << Endl; return 0;} // ~ issgistl.cpp
Compile BCC32 ISSGISTL.CPP
咦, strange, Linker reports not finding STLPORT_BCC_STATIC.LIB, to C: / STL4BC / LIB, I don't have this file, there is a stlport_bcb55_static.lib. The author found that this is a small problem with Stlport, you need to make a little change in the name of the library file:
Copy Stlport_BCB55_STATIC.LIB Stlport_BCC_STATIC.LIB
This is relatively stable, the original stlport_bcb55_static.lib is also retained. When compiles other options, similar problems may also be encountered, as long as the name of the gourd, the name is no problem.
Now compile, there should be no problem. There may be some Warning, there is no relationship. As long as you can run, you will mean that the Rope container works, that is, your SGI STL starts working.
Microsoft Visual C 6.0: Microsoft Visual C 6.0 is the mainstream of the mainstream of the C compiler under Windows, but is not satisfactory for ISO C . The STL performance it is also relatively poor. However, since it is the mainstream, Stlport naturally does not dare to neglect, the STLPORT configuration method in the VC is described below.
In the following description, assume that the Windows you use is in the C: / Windows directory. The VC is mounted in C: / Program Files / Microsoft Visual Studio / VC98; and the Stlport is placed in C: / STL4VC. C: / STL4VC should have the following:
Make sure C: / Program Files / Microsoft Visual Studio / VC98 / BIN is in your PATH environment variable.
Next step:
0. This configuration task is completed in the DOS command state, first select the MS-DOS mode from the "Start" -> "Attachment" menu, open a DOS window.
1. In C: / Program Files / Microsoft Visual Studio / VC98, you can modify the two files vcvars32.bat in your handful text editor, two lines.
Set include =% msvcdir% / ATL / include;% msvcdir% / include;% include% SET lib =% msvcdir% / lib;% msvcdir% / mfc / lib;% LIB%
Change to:
Set include = C: / STL4VC / stlport;% msvcdir% / atl / include;% msvcdir% / include; /% msvcdir% / mfc / include;% include% set lib = C: / STL4VC / LIB;% MSVCDIR% / LIB;% MSVCDIR% / MFC / LIB;% LIB%
The above reading "/" symbols folded too long into two lines, and the actual file is still a line.
Save after modification, then execute the command vcvars32. Everything should be given a line of results:
Setting Environment for Using Microsoft Visual C Tools.
If your preset DOS environment space is insufficient, this BAT file execution may cause environmental space overflow. At this time, you should find the "Memory" page in the "Properties" dialog box of the DOS window, modify the initial environment "ComboBox, change to one A larger value, such as 1280 or 2048. Then open a DOS window again and run vcvars32.bat.
2. Enter into the C: / STL4VC / SRC directory.
3. Execute the command Copy vc6.mak makefile
4. Run Make Clean All
If the BCB compiled STLPORT is very long, then the process of VC compiling the Stlport is even longer. The screen refused to reversely display the same content, please keep patience, which is actually a target library for different nature of different compilation switches.
5. After a long compilation, finally ended. Now you will execute the command
Make Install
This time it takes less than that, but it is a bit patience.
6. OK, very successful. The following step should be to check that there is not really the SGI STL. It's almost the process of the BCB above, find a program that uses the SGI STL characteristics, such as using the programs of ROPE, SLIST, Hash_SET, HASH_MAP, etc. to compile. Note that you must use the following format when compiling:
CL / GX / MT Program.cpp
This syntax is not supported in the SGI STL. This syntax is not supported by VC default, / gx is required to support VC Compiler to open support for exception handling syntax. / MT is a Linker that requires VC. The OBJ file is connected to libcmt.lib because SGI STL is Thread-Safe, and must be run in Multi-Thread. To use SGI STL in the graphical interface, you can adjust the Project -> Setting (Alt F7) in the VC, set the compile option, pay attention to use / MT and / GX, and import options / IC: / STL4VC / Stlport and / / LibPath: C: / STL4VC / LIB.
The entire process runs more than 3 hours on the author's vintage Pentium 150, and the reader's machine is much better, but it will inevitably take the time you expect. After all completed, the volume of C: / STL4VC is also expanded from the original zone 4.4m to terrible 333M, of course, this is 300m is generated during the compilation process. If you are sure that your STLPORT is working properly, You can delete them, save your hard disk space. But then, if you compile it next time, you have to wait a long time.
In addition, according to the author's investigation, SGI STL used by Stlport 4.0 is not the latest version of the SGI STL3.3. I don't know what effect, if I have the SGI STL3.3 code, I will have the effect, and interested readers may wish to try.
The general situation is like this, now, set the end of the STLPORT self-contained document:
Have fun!
Meng Yan 2001-3-11