找不到 boost-thread-mt 库

找不到 boost-thread-mt 库

我正在编译一个需要 boost-thread-mt 库的程序。我已经安装了 libboost-all-dev,sudo apt-get install libboost-all-dev但编译器说找不到 boost-thread-mt 库。这个库在其他包中吗?请指导我需要安装什么。

答案1

后缀-mt已被删除。已安装的 Boost 库是多线程安全的。

您可以编译您的程序libboost-thread。通过更改源代码以使用非-mt库或通过创建符号链接libboost_thread.alibboost_thread-mt.a。如果您需要共享库,则同样如此.so

答案2

关联与这个问题相关。

您不妨尝试从源代码编译 boost,而不是使用 apt-get 版本。

这些论点--layoutthreadingbuild-type将会有所帮助。

--layout=<layout>     Determines whether to choose library names
                      and header locations such that multiple
                      versions of Boost or multiple compilers can
                      be used on the same system.

                      versioned - Names of boost binaries
                      include the Boost version number, name and
                      version of the compiler and encoded build
                      properties.  Boost headers are installed in a
                      subdirectory of <HDRDIR> whose name contains
                      the Boost version number.

                      tagged -- Names of boost binaries include the
                      encoded build properties such as variant and
                      threading, but do not including compiler name
                      and version, or Boost version. This option is
                      useful if you build several variants of Boost,
                      using the same compiler.

                      system - Binaries names do not include the
                      Boost version number or the name and version
                      number of the compiler.  Boost headers are
                      installed directly into <HDRDIR>.  This option
                      is intended for system integrators who are
                      building distribution packages.

                  The default value is 'versioned' on Windows, and
                  'system' on Unix.

因此,尝试使用此命令来安装 boost,之后bootstrap.sh --prefix=/path/of/yours

./b2 install -j16 threading=multi --layout=tagged --build-type=complete

然后你就会得到所有的-mt库。

答案3

如果您的项目使用CMake,则以下开关在FindBoost模块必须关闭:-DBoost_USE_MULTITHREADED=OFF

相关内容