zoukankan      html  css  js  c++  java
  • Boost环境配置及遇到的问题解决方案

    1.模块/工具简介

    Boost库是一个跨平台,开源并且完全免费的C++库,内容涵盖字符串处理、正则表达式、容器与数据结构、并发编程、函数式编程、泛型编程、设计模式实现等许多领域,使得实际的开发更加灵活和高效。(下载最新版的Boost库http://www.boost.org/


    2.系统要求

    Windows xp以上


    3.部署步骤
    (1)选择下载Boost库Windows版的安装包,解压至硬盘任意目录(建议硬盘根目录),下面用$BOOSTDIR表示boost的存放目录
    (2)在解压的文件夹中找到bootstrap.bat并运行,生成bjam的可执行程序,运行即可
    (3)编译完成后会生成bin.v2和stage子目录,里面包含了生成的*.lib库文件

    (4)配置vs环境,创建测试项目test,工具栏项目->右键->test属性->配置属性->C/C++->常规->附加包含目录中添加$BOOSTDIR路径(C:oost_1_54_0;),在链接器->常规->附加库目录中添加$BOOSTDIRstagelibs(C:oost_1_54_0stagelib*.lib),应用并确定,boost库在win32环境下就部署成功了!


    4.可能遇到的问题

    (1)LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-s-1_52.lib'

    到库文件去看,只存在libboost_thread-vc100-mt-1_52.lib,两者有什么差别呢
    -s

    ABI tag: encodes details that affect the library's interoperability with other compiled code.  For each such feature, a single letter is added to the tag:

    KeyUse this library when:Boost.Build option
    s linking statically to the C++ standard library and compiler runtime support libraries. runtime-link=static
    g using debug versions of the standard and runtime support libraries. runtime-debugging=on
    y using a special debug build of Python. python-debugging=on
    d building a debug version of your code.7 variant=debug
    p using the STLPort standard library rather than the default one supplied with your compiler. stdlib=stlport

    For example, if you build a debug version of your code for use with debug versions of the static runtime library and the STLPort standard library in “native iostreams” mode, the tag would be:-sgdpn.  If none of the above apply, the ABI tag is ommitted.

    原来,-s 代表 “runtime-link-static",我的工程是用这种方式使用boost库的,因此需要'libboost_thread-vc100-mt-s-1_52.lib'

    解决方案:
    重新编译boost库,用下面的编译命令:
    b2 --build-dir=c:oost-build --build-type=complete msvc stage link=static

    (2)Already defined in libcmt.lib
    解决方案参加上一篇文章

    附:VS2010 静态链接 Boost 函数库的配置方法:
    打开项目属性->配置属性->C/C++->代码生成,选择“运行库”为“多线程 (/MT)”(如选择“多线程 DLL (/MD)”,则为动态链接 Boost 库)。

  • 相关阅读:
    .net core + mvc 手撸一个代码生成器
    如何使用VS Code编写Spring Boot (第二弹)
    第五章 .net core该怎么玩
    第四章 .net core做一个简单的登录
    第三章 搭建一个通用的权限管理系统
    第二章 在Linux上部署.net core
    将博客搬至CSDN
    Entity Framework6 with Oracle(可实现code first)
    利用windbg查找dictionary导致IIS占CPU100%案例分析(一)
    VS快捷键以及Reshaper快捷键
  • 原文地址:https://www.cnblogs.com/riskyer/p/3327609.html
Copyright © 2011-2022 走看看