zoukankan      html  css  js  c++  java
  • VS2013编译boost1.55库

    1. 官网下载最新的Boost库,我的是1.55

    2.

    在使用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

    3. 编译

    64位编译:

    1. 从开始菜单启动Visual Studio 2013的vs2013 x64兼容工具命令行,然后转到boost根文件夹,运行bootstrap.bat生成x64版的bjam.exe。
    2. 运行命令:   

    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工程的包含目录和库目录

    添加库目录

    5. 测试程序

       新建一个空的Win32 Console Application项目

    #include <iostream>
    #include <boost/lexical_cast.hpp>
    #include <boost/timer.hpp>
    
    int main()
    {
        int a = boost::lexical_cast<int>("123");
        double b = boost::lexical_cast<double>("123.0123456789");
        std::string s0 = boost::lexical_cast<std::string>(a);
        std::string s1 = boost::lexical_cast<std::string>(b);
        std::cout << "number is: " << a << " " << b << std::endl;
        std::cout << "string is: " << s0 << " " << s1 << std::endl;
    
    
        int c = 0;
        try
        {
            c = boost::lexical_cast<int>("abcd");
        }
        catch (boost::bad_lexical_cast & e)
        {
            std::cout << e.what() << std::endl;
            return -1;
        }
    
    
        return 0;
    }


    6. 运行结果:

    number is: 123 123.012
    string is: 123 123.0123456789
    bad lexical cast: source type value could not be interpreted as target
    Press any key to continue . . .

  • 相关阅读:
    word中怎么插入各种水平分隔线?
    Shell脚本--磁盘空间有超过80%时发信息
    Linux、Ubuntu 系统安装 MYSQL-python 失败解决方案
    安卓 okhttp 拦截重复请求
    安卓 drawable xml 实现多边框背景
    安卓 实现IOS阻尼回弹效果
    安卓 TextToSpeech: speak failed: not bound to TTS engine
    安卓 验证码输入框InputCode(同时支持密码输入)
    安卓 viewpager2动态设置滚动速度
    安卓 节点进度条NodeProgressBar
  • 原文地址:https://www.cnblogs.com/davidgu/p/4461145.html
Copyright © 2011-2022 走看看