vc++2010 under Compile Stlport,boost

Source: Internet
Author: User
Tags abs visual studio 2010

vc++2010 under Compile Stlport,boost

Recently in the process of trying to move to boost, trying to master the boost code,

STLport Version: 5.2.1

Boost version: 1.4.6.1 (1.4.7.0 OK)

Compiler Visual Studio 2010

For STLport compilation, select Microsoft Visual Studio 20010 under Visual Studio Tools under the command-line Environment compilation tool, Visual Studio Command Prompt (2010).

Enter the STLport directory, run

1234 cd E:\HaveFun\STLport\STLport.5.2.1configure.bat msvc9cd build/libnmake clean install

But there is an error in compiling,

123 E:\HaveFun\STLport\STLport.5.2.1\stlport\stl/_cstdlib.h(158) : error C2084: function ‘__int64 abs(__int64)‘already has a bodyC:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\../include/stdlib.h(471) : see previous definition of ‘abs‘NMAKE : fatal error U1077: ‘"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"‘ : returncode ‘0x2‘

It is estimated that STLport has not supported the 2010 problem caused, checked the code, and Google a bit of a problem, the _cstdlib.h (158) code is corrected to,

123 #if !defined(_STLP_MSVC) || (_STLP_MSVC < 1600)inline_STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return__x < 0 ? -__x : __x; }#endif

Note _stlp_msvc and _msc_ver is an east, is the VC version number,

The STLport compilation was soon completed, and now the machine is ready to take care of the library. There should be 2 STLport versions by default, using a dynamic library version that runs Scut dynamically, using the static library version of the Static runtime library. While the file name contains the version of STLD, the debug mode version is in effect when you use the macro _stlp_debug.

STLport will automatically link, and depending on whether your project chooses to use a dynamic runtime library or a static runtime library for control, decide whether you want to use a static library or a dynamic library, and if you wish your project to use dynamic runtime Library, while linking STLport's static library must use the cross-compiled library, compile the macro using the _stlp_use_static_lib in the Host.h file, and use the parameters Configure.bat MSVC9 when configuring-- With-dynamic-rtl. See the table below for details.

Release Notes

The resulting file

Compilation instructions

Instructions for use

Dynamic library version with dynamic run Scut

Stlport.5.2.dll Stlport.5.2.lib

Stlportd.5.2.dll Stlportd.5.2.lib

Stlportstld.5.2.dll Stlportstld.5.2.lib

The default is to generate

Stlportstld.5.2.lib is the debug mode version, using the Macro _stlp_debug control

&NBSP;

stlport_static.lib

stlportd_static.lib

stlportstld _static.lib

The default is to generate

stlportstld_static.lib is a debug version, using the macro _stlp_debug control

Stlportstld_x.5.2.lib stlportstld_x.5.2.dll

stlportd_x.5.2.lib Stlportd_x.5.2.dll

stlport_x.5.2.lib Stlport_x.5.2.dll

configuration to

configure.bat msvc9 -- With-static-rtl

to modify

stlport/stl/config/ Host.h

add # define _stlp_use_dynamic_lib

Debug version requires macro _stlp_debug

Using the static library version of the dynamic run-time library

Stlportstld_statix.lib

Stlportd_statix.lib

Stlport_statix.lib


When configuring to

Configure.bat MSVC9--with-dynamic-rtl

To modify

Stlport/stl/config/host.h

Add # define _stlp_use_static_lib

Debug version requires macro _stlp_debug

Note If you need a static library version of the Dynamic Runtime library (True bypass), compile the normal version Configure.bat MSVC9, compile the nmake clean install, and then change the Host.h file to add the # define _stlp_use_ Dynamic_lib (Open the comment), and then Configure.bat msvc9--with-dynamic-rtl, and then compile. Why are you doing this? Because STLport's compilation script is not to be copied first copy the dynamic library version ..., this error let me in compile VS2012 version of the time to toss the 1 days. The memorial is hereby stated.

If you want to use STLport code in your code, rather than Microsoft's default STL implementation, you have to adjust the settings, VC2010 's directory settings have changed a lot. The previous version of the setup path is under the menu Tools\Options VC + + directory under the adjustment, convenient and quick, VS2010 did a very annoying change design, you must first open a project, open the menu View\property Manager, Select project, choose Project under Debug| WIN32 and release| WIN32 The following Microsoft.Cpp.Win32.user, note that both layers of the menu can open the options interface, but one is engineering, one is global (be sure to choose Microsoft.Cpp.Win32.user this layer), I often confused, and then confused.

Then make the directory adjustment, note to remove the inheritance option, and then put the STLport directory in front of all the directory, let back the default of the entry to the back of it (for the inheritance of the order can not adjust the directory), more trouble than the original. It is said that this change is to VS2010 beta when someone wants to provide different libaray management for different users, I rely on his ancestors board, programmers have a few people and others share the PC, but also programming directory inconsistencies.

The boost compilation is a bit more painful. First, my 4-core machine will compile for a few hours to compile. Let's be patient.

Of course if your request is not high, you can choose a simple way to get boost has compiled the library, Liangfeng recommended a website to me, www.boostpro.com. There will be a variety of version vs version, each version number of the Boost library for you to download, and are fully automated, very convenient. Such as:

As can be seen, Boostpro provides vc2003,vc2005,vc2008,vc2010, multi-threaded Dynamic Runtime library version, multi-threaded dynamic Runtime library static database version, multi-threaded static runtime Library static repository version (10 m each), single-threaded static runtime library version. Note that if you download the whole, there are several G files, the process of downloading a little patience.

Of course, the result of automatic is the price, one is downloaded to your library does not provide PDB files, if you want to debug the Boost library code, found the problem, this trick will not be used. Second, he provided the download source code files inside only the header file, third, if you want to use Stlport+boost (STLport as the underlying library, instead of using the implementation of Microsoft), Boostpro site does not provide such a library for you to download. Four is that he does not currently have a 64-bit version.

I want to use STLport instead of the existing library implementation, I have to choose to compile myself.

To illustrate, the current version of the Boost library is easy to compile, and will automatically identify those libraries that can be compiled and those that cannot be compiled. Still choose visual Studio Command Prompt (2010) To enter the boost root directory,

CD E:\HaveFun\Boost\boost.1.46.1

Bootstrap.bat

The Bjam.exe is produced.

Boost build documentation such as binding cloth, smelly and long, if you do not have the patience to directly see the help of Bjam,

Bjam--help

But the unfortunate is that there is no explanation if you want to use stlport how to help, this only look at the help document. If you want to use STLport as the underlying compilation boost, see the description of boost in detail, Chapter 33. Boost.build V2 in the User Manual reference

1234567 STLport libraryThe STLport library is an alternative implementation of C++ runtime library. Boost.Build supports usingthat library on Windows platfrom. Linux is hampered by different naming of libraries in each STLport version and is not officially supported.Before usingSTLport, you need to configure it in user-config.jam usingthe following syntax:usingstlport : [version] : header-path : [library-path] ;Where version is the version of STLport, for example 5.1.4, headers is the location where STLport headers can be found, and libraries is the location where STLport libraries can be found. The version should always be provided, and the library path should be provided ifyou‘re using STLport‘s implementation of iostreams. Note that STLport 5.* always uses its own iostream implementation, so the library path is required.When STLport is configured, you can build with STLport by requesting stdlib=stlport on the command line.

If you want to use the STLport library by default, you need to edit Project-config.jam to add a line

Using Msvc;

Using Stlport:5.2.1:e:/havefun/stlport/stlport.5.2.1/stlport:e:/havefun/stlport/stlport.5.2.1/lib;

#注意路径用/, or \ \

Explain the compilation parameters and properties,

Threading=single,multi of course, the single-threaded version of what you use, do not compile can also save the general time.

Link=shared,static whether the generated library is static or dynamic

Runtime-link= shared,static, the runtime library uses dynamic or static.

Stdlib=stlport using STLport

--build-type=commplete,minimal Commplete identifies all versions compiled, minimal compiles only multi-threaded static library versions.

--stagedir=./stage refers to a directory of locally-built repositories,

--show-libraries shows all the libraries that need to be compiled, in fact not many, God knows why so much space.

--with-<lib> Compile the libraries you want to compile separately

--without-<lib> compiles all the libraries except that you have not compiled them.

Then you can start compiling, note the path name

1 bjam threading= multi link=shared,staticstdlib=stlport --stagedir=./stage
Compile all: Bjam--toolset=msvc-10.0 threading=multi link=shared,static--build-type=complete--statedir=./stage

Then there is a long wait ... and wait .... Wait...... If you compile it all, you can at least spend the time watching a movie ...

1.46 version generated static library under Stage\lib, the dynamic library and the corresponding link library under Bin.v2. Bin.v2 below, the directory layer after level, it is recommended that you all search the copy, put in a directory (I generally like to put all the library under a directory). 1.47 version seems to be all put in the stage directory, a lot of trouble.

Boost is based on each library to generate the corresponding. lib file, I really do not understand why not merged into a library file.

Plus, boost uses the technology to help you automatically link, which saves you a lot of trouble. The name of the boost library is more dazzling than the stlport, and the suffix meaning is simply a fancy eye for confusion. Like Libboost_serialization-vc100-mt-sgdp-1_49.lib.

The front is the library name, vc100 represents the compiler, and the last is the version number. Let's explain the meanings of the characters in the middle:

Meaning of the tag in the version number

Meaning of the expression

LIB Prefix

Static library version (dynamic library version does not have LIB prefix)

vc100

Compiler version good, vc100 identity vc10.0

S

Run-time library trial of Static library version (run-time library trial Dynamic library version without special tags)

Gd

Debug Debugging version (Release version has no special tag)

P

Using STLport as a version of the STL implementation,

Mt

Multi-threaded version, (single-threaded edition without special tags)

Note that the Boost debug version uses STLport with debug mode, compiling your code must define _stlp_debug=1, when the compiler goes back to the STLport version of the link debug mode.

Recently plan to study the boost library carefully and prepare to replace your common ACE Library with boost in your daily work as a cross-platform implementation. Everyone waits patiently for the following articles.

"The writer is Fullsail (Wild Goose Crossing Cold Pond), in the spirit of freedom, you can in the absence of profit in the full reprint of this document, reproduced when please attach blog link: http://www.cnblogs.com/fullsail, otherwise each word one yuan does not bargain. Baidu Library increase by one-fold "

vc++2010 under Compile Stlport,boost

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.