与升压编译时错误 [英] Error when compiling with boost

查看:128
本文介绍了与升压编译时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所著,它使用&LT工程;升压/线程/ locks.hpp> ,我加入包含目录附加包含目录 LIB 文件夹链接。但是,当我尝试建立的解决方案,错误:


  

1的错误LNK1104错误:无法打开文件'libboost_thread-VC100-MT-SGD-1_50.lib


我搜查lib目录下这个文件,但这个名字在lib目录中没有文件。我发现文件具有类似名称 libboost_thread-VC100-MT-GD-1_50

我在做什么错了?


解决方案

您的问题似乎是一个类似于在<一pretty href=\"http://stackoverflow.com/questions/3460316/boost-autolinks-libraries-which-are-not-build-by-boost-but-the-intented-once-ar\">this问题。根据命名规则描述这里连接器要使用磁带库之间的唯一区别和你有库是前者静态链接到C ++标准库和编译器运行支持库。我能想到的两种方法来解决这个问题:


  1. 获取链接器要库结果
    一个。如果您使用boostpro安装程序:


      

    请确保您勾选了多线程调试,静态运行(我会建议您将它们标记全部)


    乙。如果你自己建库:


      

    打开一个控制台窗口结果
      更改目录到你的提振根结果
      下面的命令构建所需的库:结果
       B2工具= MSVC-10.0 --with线程地址模型= 64 =变种调试链接=静态运行时链接=静态运行调试=在舞台上结果
      (我会建议使用:结果
       B2工具= MSVC-10.0地址模型= 64 --build型=完整的阶段



  2. 使连接器使用你想要库结果
    一个。请自动链接使用共享库


      

    您可以定义BOOST_THREAD_DYN_LINK(仅影响线程库)或BOOST_ALL_DYN_LIB(pferably在你的VC项目preprocessor设​​置或$ P $)包含头文件之前(影响所有Boost库)。这将使连接尝试使用库 boost_thread-VC100-MT-GD-1_50.lib (注意lib- preffix丢失)。


    乙。禁用自动链接


      

    您可以定义BOOST_ALL_NO_LIB,然后在你的连接选项添加库的确切名称



I writed project which uses <boost/thread/locks.hpp>, i added include directory to Additional Include directories, and lib folder to linker. But when i try to build solution, error:

Error 1 error LNK1104: cannot open file 'libboost_thread-vc100-mt-sgd-1_50.lib'

I searched this file in lib directory, but no file with this name in lib directory. I found file with similar name libboost_thread-vc100-mt-gd-1_50.

What i'm doing wrong?

解决方案

Your problem seems to be pretty similar to the one in this question. According to the naming conventions described here the only difference between the library the linker wants to use and the library you have is that the former links statically to the c++ standard library and the compiler runtime support libraries. I can think of two ways to solve this problem:

  1. Get the library the linker wants
    a. If you used the boostpro installer:

    Make sure you check the box for Multithreaded debug, static runtime (I would recommend you mark them all)

    b. If you built the library yourself:

    Open a console window
    Change directory to your boost root
    The following command builds the required library:
    b2 toolset=msvc-10.0 --with-thread address-model=64 variant=debug link=static runtime-link=static runtime-debugging=on stage
    (I would recommend using:
    b2 toolset=msvc-10.0 address-model=64 --build-type=complete stage)

  2. Make the linker use the library you want
    a. Make autolink use the shared libraries

    You can define BOOST_THREAD_DYN_LINK (to affect only the thread library) or BOOST_ALL_DYN_LIB (to affect all the boost libraries) before the inclusion of the header files (or preferably in your VC project preprocessor settings). This would make the linker try to use the library boost_thread-vc100-mt-gd-1_50.lib (note that the lib- preffix is missing).

    b. Disable autolink

    You can define BOOST_ALL_NO_LIB and then add the exact name of your library in your linker options

这篇关于与升压编译时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆