VS2013编译boost1.55库

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

 

2.

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

boost_1_55_0\boost\intrusive\detail\has_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=".\bin\vc12_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 . . .

 

时间: 2024-07-30 17:04:19

VS2013编译boost1.55库的相关文章

visual studio-运行VS2013编译的程序,在其他电脑提示没有找到msvcp120d.dll

问题描述 运行VS2013编译的程序,在其他电脑提示没有找到msvcp120d.dll 如题:VS2013编译的程序,在其他电脑运行提示没有找到msvcp120d.dll 把对应文件加入对应目录,依然提示没有找到msvcp120d.dll 解决方案 楼主是把自己电脑上编译出来的.exe放到别的电脑上跑了? 解决方案二: 应该把msvcp120d.dl这个文件复制到你的应用程序所在目录的bin目录下, 然后,用assembly属性提定该文件. 解决方案三: 需要带上VC的运行时库的环境. 解决方案

用VS2013编译opengl编程宝典第五版的第一个画三角形的例子,编译后程序运行不了

问题描述 用VS2013编译opengl编程宝典第五版的第一个画三角形的例子,编译后程序运行不了 代码如下: #include #include #define FERRGLUT_STATIC #include #include GLBatch trianglebatch; GLShaderManager shadermanager; int main(int argc, char* argv[]) { void RenderScene(); void ChangeSize(int w, int

如何在WINDOWS下编译BOOST C++库 .

如何在WINDOWS下编译BOOST C++库 cheungmine 2008-6-25   写出来,怕自己以后忘记了,也为初学者参考.使用VC8.0和boost1.35.0.   1)下载boost http://www.boost.org/users/download/ 这是它的下载页面,需要下载2个东西: Packaged Releases VERSION 1.35.0 和 Boost Jam 3.1.16   你需要在每个条目下面找到Details | Download字样,点击Down

Mac OS下为Android Studio编译FFmpeg解码库的详细教程_Android

NDK部分 1.下载ndk这里就一笔带过了. 2.解压ndk不要解压,文件权限会出错.执行之,会自动解压,然后mv到想放的地方.我放到了"/usr/local/bin/android-ndk-r10d"(此目录之后用$NDK_DIR指代). 3.下载Ffmpeg我下的是2.5.3版本. 4.解压Ffmpeg解压Ffmpeg到$NDK_DIR/sources/ffmpeg-2.5.3. 5.修改Ffmpeg编译配置在ffmpeg-2.5.3目录下把configure文件中的这几行,目的是

Mac OS下为Android Studio编译FFmpeg解码库的详细教程

NDK部分 1.下载ndk 这里就一笔带过了. 2.解压ndk 不要解压,文件权限会出错.执行之,会自动解压,然后mv到想放的地方.我放到了"/usr/local/bin/android-ndk-r10d"(此目录之后用$NDK_DIR指代). 3.下载Ffmpeg 我下的是2.5.3版本. 4.解压Ffmpeg 解压Ffmpeg到$NDK_DIR/sources/ffmpeg-2.5.3. 5.修改Ffmpeg编译配置 在ffmpeg-2.5.3目录下把configure文件中的这几

webkit2-webkit 成功编译过windows库

问题描述 webkit 成功编译过windows库 有编译成功window webkit的库提供,包括头文件,DLL,LIB 解决方案 http://www.cnblogs.com/Jiajun/archive/2012/06/06/2537515.html 解决方案二: @oyljerry 那个编译起来很费功夫,还有其他浏览器插件可以嵌入MFC的

windows ndk 编译 boost网络库

问题描述 windows ndk 编译 boost网络库 求指教,小弟,不会弄那个路径,不知道咋配置BOOST路径就指教 解决方案 参考:http://blog.csdn.net/ly131420/article/details/46648125 解决方案二: 在windows下编译boost库如何在WINDOWS下编译BOOST C++库ndk 编译 boost 库

android-有人处理过libjpeg-turbo编译出so库吗?

问题描述 有人处理过libjpeg-turbo编译出so库吗? 有人处理过libjpeg-turbo编译出so库吗?我编译的时候,老是在汇编simd那边会报出方法未定义的错误..有没有有这方面经验的

编译出错-用vs2013编译之前用vc++6.0写的程序报错

问题描述 用vs2013编译之前用vc++6.0写的程序报错 用vs2013编译之前用vc++6.0写的程序 以上是报错代码 错误 1 error MSB8021: The value '{0}' of the variable '{1}' is incompatible with the value '{2}' of the variable '{3}'. C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V120Microsoft.CppBuild.t