Win7 under vs2010 compile debugging STL source code

Source: Internet
Author: User

Platform Environment: Windows 7 32-bit +VS2010+STL source code 5.2.1

STL in SourceForge download, if not can download, can download in csdn.

Download good source code, first extracted to the hard disk, I extracted to D:\STL.

Select "Visual Studio command Prompt (VS2010)" in VS2010 tools

In the cmd window, the directory switches to the root directory of the source just extracted,

Enter Configure-help to view compilation options

Display platform XP, here for the time being.

Input Configure MSVC9 configuration environment

The contents of the red box above do not need to be tube.

After you switch the directory to Build/lib, enter the NMAKE clean install compile and the following error occurs:

is the header file _cstdlib.h in the 158 line of the problem, with a 32-bit machine, _int64 may not support, comment out this line.

Find _cstdlib.h in directory Stlport-5.2.1\stlport\stl, comment out 158 lines

[CPP]View Plaincopy
    1. Inline _stlp_long_long abs (_stlp_long_long __x) {return __x < 0?-__x: __x;}


Then run NMAKE clean install to compile the installation, which takes several minutes.

It can then be used in the VS2010. Open VS2010, create a new project, I am new to the empty console project.

Right-click on the project-select Properties,

We are going to include the newly compiled library into this project, select the VC + + directory, add the Stlport-5.2.1\stlport directory in the Include directory, add the Stlport-5.2.1\lib directory in the library directory, and then OK.

Then copy the six files in the Stlport-5.2.1\bin directory to the root of the newly created project, and note that the "project root" is not the root directory of the entire solution. Then you can use it, and debugging can go into the source code to see the execution process.

STL can also be used with the following macro definitions:

[CPP]View Plaincopy
    1. #define _STLP_USE_STATIC_LIB//use STLport Static library
    2. #define _STLP_USE_DYNAMIC_LIB//using STLport Dynamic Library
    3. #define _STLP_DEBUG//STLport enable the check function in DEBUG mode
    4. #define _STLP_USE_BOOST_SUPPORT//STLport for use with the BOOST library

With the code of the newly built project, it is very simple to note that include uses double quotation marks, do not use angle brackets.

[CPP]View Plaincopy
      1. #include <iostream>
      2. #include "vector"
      3. Using namespace std;
      4. int main ()
      5. {
      6. vector<int> v;
      7. V.push_back (1);
      8. V.push_back (2);
      9. return 0;
      10. }

Win7 under vs2010 compile debugging STL source code

Related Article

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.