STLport 安装指南

原文链接:http://blog.sina.com.cn/s/blog_5551e55e010003el.html


STLport-4.6 是完全兼容ANSI C++标准的类库。


This distribution contains STLport sources only, no binaries.
To use STLport iostreams, you have to build STLport library from sources in "src"
directory and link your programs with it.
这个发布包仅仅包括STLport源代码马,不含二进制发布软件包。必须重新编译src目录下的代码才可以使用STLport iostreams类库。
This is major change since pre-4.0 releases, please read the instructions carefully.
这是自4.0版本发布以来的重要变更版本,请仔细的阅读下面的操作指南。

==== Unpacking and installing STLport ==========
解包和安装STLport

1) Unpack STLport archive to a directory accessible during compilation.
 
  NOTE : DO NOT overwrite header files coming with the compiler, even if you made
    a backup - this won't work ! Most probably, you've already unpacked the archive before
    reading this file though ;)
首先吧STLport安装包解压缩到一个目录。注意:不要覆盖了编译器自带的头文件,即使你已经做了备份,也不要这么做!
2) Make sure "stlport" directory of this distribution comes before compiler's one
    in your search path when you compile the project;
确保stlport目录在编译器自带的头文件搜索路径之前
    Note: for SunPro CC 5.0 and higher, there used to be special directory "stlport/SC5"
  this is now obsolete, please make sure you do not use it anymore.
注意:对于SunPro CC 5.0或者更高版本,有一个特殊的目录stlport/SC5,这个目录已经背废弃了,请不要再使用这个目录。
3) Make sure you do not rename this "stlport" subdirectory -
    that may result in compilation errors.
确保不要修改stlport的子目录名称,否则会导致编译错误
    NOTE : Do NOT attempt to run "configure" ! It is deprecated, moved to safe standalone folder
                  and should be used as a helper to create initial config for a new compiler only.
                  Your compiler should be recognized by STLport source code with no configuring.
    Please edit appropriate configuration header for your compiler
                  directly if you have to make compiler-specific configuration changes.
注意:不要尝试运行configure命令,该方法已经废弃不用了,已经移到一个安全单独的目录,只能用于作为为新编译器的创建初始配置的辅助手段。您使用的编译器应该能够被STLport的源代码识别,如果需要针对您使用的编译器进行特殊的配置,请直接修改适当的头文件。

4)  Go to "src" subdirectory. It contains various makefiles for different
      compilers.  If you are not able to find makefile for your particular
      compiler, please use one that looks most similar to your make engine to
      create your own.
直接进入src目录,这个目录包含了各种不同编译器使用的make文件,请选择一个和你的编译器相似的make文件。
      Verify you can do command line compiles. IDE users may have to do something
      special, like add environment variables (for Microsoft) or install
      additional compiler components (for Metrowerks), before they can use their
      command line compilers.
必须在命令行方式编译,使用IDE编译需要设置一些环境变量(微软)或者安装特殊的编译组件(Metrowerks)。
    IMPORTANT :

    If you DO NOT plan to use STLport iostreams implementation, you do not have to build the library.
    Please do this instead  :
如果你不需要使用STLport iostream类库,你不必编译整个类库,请使用下面的方法
    4-1) Using appropriate makefile, do "make -f <your compiler name>.mak prepare".
      Please do not skip this! On some platforms, it creates necessary symbolic links.
              If you do build STLport iostream, this step is performed automatically when you do "make all".
使用适当的make文件,执行“make -f <your compiler name>.mak prepare”命令,不要跳过这步!在一些平台上,它创建了一些符号链接。在需要编译STLport库时,这个步骤是由“make all”自动完成的
    4-2) uncomment _STLP_NO_OWN_IOSTREAMS setting in "stlport/stl_user_config.h" to disable use
            of STLport iostreams and to use wrappers around your existing iostreams.
            After disabling STLport iostreams, you will use wrappers around  your compiler's iostreams
            libabry, as in previous STLport releases.
            No binary library for STLport needs to be built in this case.
            Note though :
              - new-style ANSI iostreams may not be available on your system;
              - compiler's iostreams are most likely slower than STLport version.
删除stlport/stl_user_config.h文件中_STLP_NO_OWN_IOSTREAMS编译常量的注释禁止使用STLport iostream类库,并且使用已经存在的iostream类库的封装类。在这种情况下不需要重建STLport二进制类库。
 
  If you have decided to disable STLport iostreams, you may stop reading here.
如果你已经决定不使用STLport iostream类库,可以不用往下阅读了。

==== Building STLport iostreams library ==========

Below are step-by-step instructions to build STLport streams library:
下面是一步一步的教你编译STLport stream类库

5)  Using appropriate makefile, do "make clean all" to build the STLport libraries
      (makefiles are set up to build several different flavors - debug/nondebug,
      static/dynamic versions).
      Optionally, do "make install" to copy STLport headers and libraries to shared location.
选择适当的make文件,执行make clean all编译STLport库,make文件设置了集中不同的编译方式-debug/nondebug和static/dynamic版本。可选的,执行 make install拷贝STLport的头文件和库文件到共享的位置。
      Note : your "make" program may have different name, like "nmake" for Visual C++.
注意:make文件可能有不同的名称,VC使用nmake
      Examples :
        1. If you are building STLport for just one compiler, you may do something like that
              (DOS syntax for Visual C++ below):
              copy vc6.mak makefile
              nmake clean all
              nmake install
例如:
  1.如果你只是为一种编译器编译STLport,方法如下:
  copy vc6.mak makefile
  nmake clean all
  nmake install

        2. If you plan to build STLport with multiple compilers, use "make -f" :
  make -f gcc.mak clean install
  make -f sunpro.mak clean install
              This will build and install STLport for gcc & SUN CC.
  2.为多个编译器编译STLport,使用make –f
  make -f gcc.mak clean install
  make -f sunpro.mak clean install
  这会编译和安装STLport gcc和SUN CC两个版本。

              "install" target works on most platforms.

  install编译依赖目标几乎在所有的平台上可以使用。

                On Win32, it does the following :
                  - copies STLport headers in "stlport" subdirectory of your compiler's INCLUDE directory;
                  - copies STLport .lib files in your compiler's LIB directory;
                  - copies STLport DLLs to Windows system directory so they can be found at runtime.
  在Win32平台上,install目标做了下面的工作:
  -拷贝STLport的头文件到编译器的INCLUDE目录
  -拷贝STLport.lib到编译器的LIB目录
  -拷贝STLport DLL库到Windows的系统目录

  On UNIX, it does the following :
                  - copies STLport headers in "stlport" subdirectory of system's local include directory (default is /usr/local/include);
                  - copies STLport .a and .so files to system local library directory (default is /usr/local/lib);
  在UNIX平台上,它完成了下面的工作
  -拷贝STLport头文件到系统local include目录(默认是/usr/local/include)
  -拷贝STLport.a和.so文件到系统的local库文件目录(默认为/usr/local/lib)
6)  If build fails, you may choose to :
        - try fixing the build ;
        - wait until somebody else will submit corresponding changes to be incorporated in next STLport
            release/snapshot. To use STLport w/o its own iostreams, please do step 3a).

      In case you do patch STLport, please submit your patches to support@stlport.com or (better)
      to STLport Forum (http://www.stlport.com/cgi-bin/forum/dcboard.cgi)
如果编译失败,你可以:
-试着修改相关文件重新编译
-等待其他人发现同样的问题,这STLport的下个发布中修改
既然你已经为STLport打了补丁,请把你的补丁发送到support@stlport.com或者(最好使用这种方式)STLport Forum(http://www.stlport.com/cgi-bin/forum/dcboard.cgi)
7) Do "make install" to install resulting libraries into "./lib" subdirectory.
  执行make install安装编译产生的库到/lib目录

==== Linking your application with STLport library ==========
链接应用程序到STLport库文件
8) Supply the "lib" subdirectory to the library search path and add desired
    library to the list of libraries to link with.
把lib目录加入到库文件的搜索路径中并且指定要链接的库名称。
    Examples (imagine you have mytest.cpp in the same directory as this file is):
  With gcc        : gcc -I./stlport mytest.cpp -L./lib/ -lstlport_gcc
  With DEC CC  : cxx -I./stlport mytest.cpp -L./lib/ -lstlport_deccxx
  With SUN CC  : CC -I./stlport mytest.cpp -L./lib/ -lstlport_sunpro
  .....
例如:
  -gcc,gcc -I./stlport mytest.cpp -L./lib/ -lstlport_gcc
  -DEC CC,cxx -I./stlport mytest.cpp -L./lib/ -lstlport_deccxx
  -SUN CC,CC -I./stlport mytest.cpp -L./lib/ -lstlport_sunpro
  ……
    [ 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.
    Appropriate version is being selected based on /MD[d] vs /MT[d] options and __STL_DEBUG setting.
    All you have to do is to set library search path for the linker.
  Example :
                    cl.exe /I.\stlport mytest.cpp /link /libpath:.\lib /MD
  -VC比较特殊,不需要显式的指定stlport-msvc-XXX.lib库文件,而是在 stlport/config/stl_select_lib.h头文件中使用#pragma指令自动选择了链接的库文件。有些版本基于/MD[d] vs /MT[d]编译选项编译,以及设置了__STL_DEBUG编译常量。只需要按照下面的设置即可:
  cl.exe /I.\stlport mytest.cpp /link /libpath:.\lib /MD

9) If you linked your application with shared STLport library (.so or .dll), please make your .so or
    .dll's to be found in PATH at runtime. On Windows, the simplest way to do it
    is to copy all .dll's to Windows system directory. Or, you might choose to add directory
    containing STLport to the PATH environment string.

10) Have fun !

10/31/03, Boris Fomitchev.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值