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;
    
    }
    结果:


  • 相关阅读:
    3500常用汉字与标点符号(已排除不支持GB2312的)
    http报头正文开头会有一个整数的问题
    Arduino "Card failed, or not present"(即找不到SD卡)错误解决方案
    Arduino运行时突然[卡死在某一行/立即重启/串口输出乱码/程序执行不正常]的可能原因
    C++编程常见错误
    本地Apache服务器访问时502 Server dropped connection 错误解决方法
    Borůvka (Sollin) 算法求 MST 最小生成树
    搜索算法总结:迭代加深、双向、启发式
    三分法
    状压 DP:[USACO06NOV] Corn Fields,[USACO13NOV] No Change
  • 原文地址:https://www.cnblogs.com/ggzone/p/4052439.html
Copyright © 2011-2022 走看看