Reference: http://jjhou.csdn.net/myan-stlport.htm
1. Directory Introduction
Decompress the stlport in the Directory D:/STLport-4.5.3/
Contents in the STLport-4.5.3 Folder:
Readme-readme file
Install-installation instructions
Doc-stlport release document
Etc-Miscellaneous files
Src-source file and compilation Project
Stlport-stlport header folder
Test-test directory
Test/regression-regression test, using the stlport Library
Test/eh-use stlport for exception handling test
Lib-this folder will be generated after compilation. This is the directory of the stlport library.
2. Modify vcvars32.bat
To C:/program files/Microsoft Visual Studio/vc98/bin/, use your handy text editor to modify the file vcvars32.bat
There are two rows.
Set include = % msvcdir %/ATL/include; % msvcdir %/mfc/include; % include %
Set Lib = % msvcdir %/LIB; % msvcdir %/mfc/LIB; % lib %
Changed:
Set include = D:/STLport-4.5.3/stlport; % msvcdir %/ATL/include; % msvcdir %/include ;/
% Msvcdir %/mfc/include; % include %
Set Lib = D:/STLport-4.5.3/LIB; % msvcdir %/mfc/LIB; % lib %
For the sake of reading, use the "/" symbol to fold a long line into two lines. The actual file is still one line.
(D:/STLport-4.5.3/lib does not exist at present, but don't worry, compiled stlport has)
Save the modification and run vcvars32. If everything goes well, we should give a line of results:
Setting environment for using Microsoft Visual C ++ tools.
3. Go to the command prompt and set the vc6.0 environment variable.
Run vcvars32.bat to set the environment variables of vc6.0. Do not close this Command Prompt window after setting.
Directory of vcvars32.bat: C:/program files/Microsoft Visual Studio/vc98/bin/vcvars32.bat
4. Compile stlport
Go to the "D:/STLport-4.5.3/src" Directory (compile only a version as described in the install file)
Copy vc6.mak makefile
Nmake clean all
The Screen repeatedly displays the same content. Please be patient. This is actually to build a target library of different nature with different compilation switches.
After a long compilation, it was over.
Run the command again.
Nmake install
OK. On the Win32 platform, "Install" does the following work:
1. The dynamic library DLL generated by stlport is copied to the System32 (NT) or system (98) directory.
2. The stlport subdirectory is copied to the include directory of the VC compiler.
3. The LIB file is copied to the lib directory of the VC compiler.
5. Then you can perform the test.
A. Compile stl_test
Go to the directory "D:/STLport-4.5.3/stlport/test/regression"
Nmake-F vc6.mak
Compile and run stl_test.exe
B. Compile eh_test
Go to the directory "D:/STLport-4.5.3/stlport/test/eh"
Nmake-F vc6.mak
Compile and run eh_test.exe (For A Long Time)
6. Test whether stlport is used in vc6.0.
To test the usage of various linked libraries, all the three-step operations performed by nmake install are revoked.
Delete the stlport header file under the include directory of the VC Compiler
Delete the stlport header file under the lib directory of the VC Compiler
Delete stlport_vc6_stldebug45.dll and stlport_vc645.dll under system32
Test Program issgistl. cpp. See 11. Test the program code issgistl. cpp.
Compile issgistl. cpp directly under vc6.0.
The following message is displayed: Fatal error c1083: cannot open include file: 'rope': no such file or directory.
This project does not contain stlsport. Include the stlport header file in Step 7
7. Configure the header file containing the stlport.
Modify project options: Project-> Settings...-> C/C ++, select Preprocessor for category,
Add: D:/STLport-4.5.3/stlport in additional include directories
After adding it, compile it again. There are still errors!
Link: Fatal error lnk1104: cannot open file "stlport_vc6_static.lib"
Why can't I find the Lib library of stlport? We have not forcibly loaded the stlport_vc6_static.lib library?
Install:
[Visual c ++ specific] for VC ++, you do not have to specify "stlport-msvc-XXX.lib" explicitly,
As it is being choosen and forced to link automatically by "# pragma"'s in stlport/config/stl_select_lib.h.
The original stlport/config/stl_select_lib.h file automatically loads the Lib library.
But how do I control the realse version or debug version? Static or dynamic link library?
Take a look at stl_select_lib.h. In the following four ways, select general in project options: Project> Settings...> C/C ++,
Two macro definitions _ stlp_debug and _ stlp_use_declspec are added to the Preprocessor definitions to control which link library to be called
Add _ stlp_debug and _ stlp_use_declspec to the debug version of the Dynamic Link Library
Add _ stlp_use_declspec to the release version stlport_vc6.lib of the Dynamic Link Library
Stlport_vc6_stldebug_static.lib of the static Link Library
Stlport_vc6_static.lib of the static link library is not added
All right. Set to debug mode of Dynamic Link Library
Copy stlport_vc6_stldebug.lib to the project root directory.
Or add the Lib path to the project and modify the project option: Project-> Settings...-> link. Select "input" for "category,
Add: D:/STLport-4.5.3/stlport in additional library path
Re-compile, no error. Run. The error message "stlport_vc6_stldebug45.dll" is not found.
Copy stlport_vc6_stldebug45.dll to the DEBUG directory of the project. Compile and run. OK, the familiar "Hello world" is coming out.
8. Configure the stlport of the vc6.0 Development Environment (this item can be skipped and configured separately in each project)
Open vc6 and choose tools> options...> directories.
Add include files path: "D:/STLport-4.5.3/stlport", move to the top.
Add library files path: "D:/STLport-4.5.3/lib", move to the top.
Copy stlport_vc6_stldebug45.dll and stlport_vc645.dll to the System32 directory.
In this way, Step 7 is not required for each project.
9. Differences between sgi stl and vc6.0 default settings
Find a program that uses the sgi stl feature, such as using a program of containers such as rope, slist, hash_set, and hash_map.
Note that the following format must be used during compilation:
CL/GX/MT program. cpp
A. /GX: Try is widely used in sgi stl .. throw .. catch, VC does not support this syntax by default, and/GX requires VC ++ compiler to enable support for exception handling syntax.
B. /MT:/MT is the linker of VC. The OBJ file of the program and libcmt are required. lib is connected together because sgi stl is thread-safe and must be run in multi-thread format.
C. To use sgi stl in the graphic interface, you can adjust project --> setting (Alt + F7) in VC and set compilation options,
Use/MT and/GX. See step 10.
And introduce option/I "d:/STLport-4.5.3.VC6.0/stlport" And/libpath: "D:/STLport-4.5.3.VC6.0/lib ". See Step 7.
For details, see 10. Configure the stlport of the project.
10. Configure the stlport thread mode of the project
Modify project options: Project-> Settings...-> C/C ++, select code generation for category.
Then select debug multithreaded in use run-time library.
(For the release version, select multithreaded)
(If you want to use dynamic links, you must first compile the stlport of the Dynamic Link version, and then select the corresponding DLL here)
11. Test the program code issgistl. cpp
// Issgistl. cpp
# Include
# Include
Using namespace STD;
Int main ()
{
// Crope is the rope container that contains char characters.
Crope bigstr1 ("hello ");
Crope bigstr2 ("world ");
Crope Story = bigstr1 + "" + bigstr2;
Cout settings...-> C/C ++, select Preprocessor for category,
Add: D:/STLport-4.5.3/stlport in additional include directories
After adding it, compile it again. There are still errors!
Link: Fatal error lnk1104: cannot open file "stlport_vc6_static.lib"
Why can't I find the Lib library of stlport? We have not forcibly loaded the stlport_vc6_static.lib library?
Install:
[Visual c ++ specific] for VC ++, you do not have to specify "stlport-msvc-XXX.lib" explicitly,
As it is being choosen and forced to link automatically by "# pragma"'s in stlport/config/stl_select_lib.h.
The original stlport/config/stl_select_lib.h file automatically loads the Lib library.
But how do I control the realse version or debug version? Static or dynamic link library?
Take a look at stl_select_lib.h. In the following four ways, select general in project options: Project> Settings...> C/C ++,
Two macro definitions _ stlp_debug and _ stlp_use_declspec are added to the Preprocessor definitions to control which link library to be called
Add _ stlp_debug and _ stlp_use_declspec to the debug version of the Dynamic Link Library
Add _ stlp_use_declspec to the release version stlport_vc6.lib of the Dynamic Link Library
Stlport_vc6_stldebug_static.lib of the static Link Library
Stlport_vc6_static.lib of the static link library is not added
All right. Set to debug mode of Dynamic Link Library
Copy stlport_vc6_stldebug.lib to the project root directory.
Or add the Lib path to the project and modify the project option: Project-> Settings...-> link. Select "input" for "category,
Add: D:/STLport-4.5.3/stlport in additional library path
Re-compile, no error. Run. The error message "stlport_vc6_stldebug45.dll" is not found.
Copy stlport_vc6_stldebug45.dll to the DEBUG directory of the project. Compile and run. OK, the familiar "Hello world" is coming out.
8. Configure the stlport of the vc6.0 Development Environment (this item can be skipped and configured separately in each project)
Open vc6 and choose tools> options...> directories.
Add include files path: "D:/STLport-4.5.3/stlport", move to the top.
Add library files path: "D:/STLport-4.5.3/lib", move to the top.
Copy stlport_vc6_stldebug45.dll and stlport_vc645.dll to the System32 directory.
In this way, Step 7 is not required for each project.
9. Differences between sgi stl and vc6.0 default settings
Find a program that uses the sgi stl feature, such as using a program of containers such as rope, slist, hash_set, and hash_map.
Note that the following format must be used during compilation:
CL/GX/MT program. cpp
A. /GX: Try is widely used in sgi stl .. throw .. catch, VC does not support this syntax by default, and/GX requires VC ++ compiler to enable support for exception handling syntax.
B. /MT:/MT is the linker of VC. The OBJ file of the program and libcmt are required. lib is connected together because sgi stl is thread-safe and must be run in multi-thread format.
C. To use sgi stl in the graphic interface, you can adjust project --> setting (Alt + F7) in VC and set compilation options,
Use/MT and/GX. See step 10.
And introduce option/I "d:/STLport-4.5.3.VC6.0/stlport" And/libpath: "D:/STLport-4.5.3.VC6.0/lib ". See Step 7.
For details, see 10. Configure the stlport of the project.
10. Configure the stlport thread mode of the project
Modify project options: Project-> Settings...-> C/C ++, select code generation for category.
Then select debug multithreaded in use run-time library.
(For the release version, select multithreaded)
(If you want to use dynamic links, you must first compile the stlport of the Dynamic Link version, and then select the corresponding DLL here)
11. Test the program code issgistl. cpp
// Issgistl. cpp
# Include
# Include
Using namespace STD;
Int main ()
{
// Crope is the rope container that contains char characters.
Crope bigstr1 ("hello ");
Crope bigstr2 ("world ");
Crope Story = bigstr1 + "" + bigstr2;
Cout
Previous: Year-end summary
Next article: Different buttons show different icons