C + + Ah, I was blank, suddenly scheduled a task, C + + to do a demo, used to communicate with the rest server.
Arduous task, every step of the record, for the borrower to borrow.
1. New Win32 Console project, vs2013
2. Install the Boost class library
Boost is a standard library similar to STL, but it expands the STL to make the benefits of generics work best. So now boost is more practical than STL. Since boost is so useful, how do you go about installing the Boost library in the Windows environment?
Let's share the operation I used to configure the Boost_1_55_0 library with VS2013
Tools/Materials
Method/Step
Download Boost Library, here I choose to download Boost_1_55_0.zip
Unzip the boost file to a local directory (such as G:\BOOST_1_55_0), and you can find a Bootstrap.bat file in the extracted file.
Then open the cmd window as an administrator, with the specific commands such as:
After execution of the above command, you can find that G:\boost_1_55_0 a new Bjam.exe file
In the Command window, enter the statement: Bjam.exe. As shown
This process will by default compile the appropriate Lib files, header files, and so on, based on the compiled tools (vs2008,2010,2012,2013) that the system has already installed. (This step takes about 10 minutes)
You can see Msvc 12.0, because I've already installed VS2013 in my system.
msvc:8.0 is VS2005.
msvc:10.0 is VS2010.
Msvc:12.0 is VS2012, VS2013
After successful execution of the 5th step, you will be prompted with the following information
-
Now that we have completed the installation of the boost library, we need to configure VS2013 below. Create a new VS2013 console application (project named Boostest) and add the following code
#include "stdafx.h"
#include <boost/lexical_cast.hpp>
#include <iostream>
using namespace std;
Int main ()
{
using Boost::lexical_cast;
int a = lexical_cast<int> ("123");
Double b = lexical_cast<double> ("123.0123456789");
String s0 = Lexical_cast<string> (a);
String S1 = lexical_cast<string> (b);
cout << "number:" << a << " " << b << Endl;
cout << "string:" << s0 << " " << s1 << Endl;
int c = 0;
try{
C = lexical_cast<int> ("ABCD");
}
catch (boost::bad_lexical_cast& e) {
cout << e.what () << Endl;
}
return 0;
}
Add the Include directory and library directory for the Boostest project
Include directory add G:\boost_1_55_0
Library Directory Add G:\boost_1_55_0\stage\lib
Specific as
Enter Code window compile and run successfully instructions The Boost library is indeed configured successfully and can be used with confidence.
Reference Address: http://jingyan.baidu.com/article/11c17a2c765763f446e39dc1.html
Write a rest demo (c + +) from scratch