Compiling and using C + + STL (STLport) using VS2012

Source: Internet
Author: User

Compiling and using C + + STL (STLport) using VS2012

http://cstriker1407.info/blog/use-vs2012-to-compile-and-use-the-c-stl-stlport/

Reference URL:

"Http://blog.csdn.net/lwc91319/article/details/10627415"
"http://blog.csdn.net/fullsail/article/details/6848945"
"Http://blog.csdn.net/goxigo/article/details/4548197"
"HTTP://HI.BAIDU.COM/DBFR2011818/ITEM/D21E23D9F804211C20E2502F"
"http://blog.csdn.net/huangxy10/article/details/7616633"

Build Steps:

First, create a new " Win32 console program " under VS2012 and compile it in " Debug " and " Release " mode, respectively, and run it once, such as:

This will cause two output folders to appear in the local directory. Such as:

Then go to STLport's website to download "http://sourceforge.net/projects/stlport/", extracted to the project subdirectory, such as:

Enter the directory, modify the 158 lines of the file " D:\HelloSTL\HelloSTL\STLport-5.2.1\stlport\stl\_cstdlib.h ", instead

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

The original:

Switch

Start the VS2012 Developer command Prompt , such as:

Then enter the following command:

C:\Program Files (x86)\Microsoft Visual Studio 11.0>D: #切换分区
。。。。
D:\>cdHelloSTL/HelloSTL/STLport-5.2.1 #切换目录
。。。。
D:\HelloSTL\HelloSTL\STLport-5.2.1>configure msvc9 #configure
。。。。
D:\HelloSTL\HelloSTL\STLport-5.2.1>cdbuild/lib#切换目录
。。。。
D:\HelloSTL\HelloSTL\STLport-5.2.1\build\lib>nmake clean install#nmake
。。。。

Wait a while for the compilation to complete.
Modify the project properties of the VS2012, and note that it is configured for all configurations, such as:

Add " D:\HelloSTL\HelloSTL\STLport-5.2.1\stlport " in " include directory "
Add " D:\HelloSTL\HelloSTL\STLport-5.2.1\lib " to " Library directory "

For the sake of simplicity, the. dll is copied directly to the output directory, and all 6 files under " D:\HelloSTL\HelloSTL\STLport-5.2.1\bin " are copied to the "D:\HelloSTL\Debug "and" D:\HelloSTL\Release "directories.
Then modify the main function to:

#include "stdafx.h"
#include "vector"
int_tmain(intargc, _TCHAR* argv[])
{
    std::vector<int> testVector;
    testVector.push_back(100);
    printf("%d", testVector.size());
    getchar();
    return0;
}

Compile, run on it. You can also debug breakpoints.

Release mode debugging

Here the author encountered a small problem, in a different environment, the debug mode of the VS2012 project will appear in the debugging of the breakpoint to enter the "D:\HelloSTL\HelloSTL\STLport-5.2.1\stlport\stl\debug" directory, The author guesses that the problem with debug mode is used, and the author uses a strange way to get debugging into the "D:\HelloSTL\HelloSTL\STLport-5.2.1\stlport\stl" directory, as follows:
switch the project to release mode and use breakpoint debugging in release Mode . At this point, to modify 3 places, such as, after modification, you can debug in release mode, this time will go to the "D:\HelloSTL\HelloSTL\STLport-5.2.1\stlport\stl" directory.

Modify point:

Compiling and using C + + STL (STLport) using VS2012

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.