zoukankan      html  css  js  c++  java
  • win8.1系统vs2013中boost 1.55.0的安装

    在使用vs2013编译boost-1.55.0之前,先要给boost做下修改:

    boost_1_55_0oostintrusivedetailhas_member_function_callable_with.hpp line:222

    template<class U>
    static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
           <U> Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);
    替换成以下内容:

    #ifdef BOOST_MSVC
         template<class U>
         static decltype(boost::move_detail::declval<Fun>().BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME()
               , boost_intrusive_has_member_function_callable_with::yes_type())
               Test(Fun*);
    #else
         template<class U>
         static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)
               <U> Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*);
    #endif

    1、管理员权限cmd中运行:

          "C:Program Files (x86)Microsoft Visual Studio 12.0VCinvcvars32.bat"编译32位

          "C:Program Files (x86)Microsoft Visual Studio 12.0VCinamd64vcvars64.bat"编译64位

    2、命令行进入boost所在目录,运行bootstrap.bat(我的64位没有执行步骤一出错)

    3、32位编译:

         

    bjam.exe stage --toolset=msvc-12.0 --without-graph --without-graph_parallel --without-math --without-mpi --without-serialization 
    --without-wave --without-test --without-program_options --without-serialization --without-signals --stagedir=".invc12_x86" link=static 
    runtime-link=shared threading=multi debug release

         64位编译:

    bjam.exe stage --toolset=msvc-12.0 --without-graph --without-graph_parallel --without-math --without-mpi --without-serialization 
    --without-wave --without-test --without-program_options --without-serialization --without-signals --stagedir=".invc12_x64" link=static 
    runtime-link=shared threading=multi debug release address-model=64  
    4、添加boostest工程的包含目录和库目录

    包含目录添加  D:oost_1_55_0

    库目录添加    D:oost_1_55_0stagelib

    具体如下图:




    5、测试代码:

    #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;
    
    	}
    	system("pause");
    	return 0;
    
    }
    结果:


  • 相关阅读:
    Java速成笔记
    C语言学习笔记
    形式语义05 Semantics
    密码学04 PRG&PRF
    形式语义04 Types
    密码学03 Computational
    形式语义03 Lambda
    密码学02 Perfect
    形式语义01 Intro
    密码学01 Intro
  • 原文地址:https://www.cnblogs.com/ggzone/p/4052439.html
Copyright © 2011-2022 走看看