c++ - 可以在linux程序中使用带有msvc的在windows上构建的lib

标签 c++ linux windows boost cmake

我在 Windows 上从源代码构建了 boost。我可以在 Windows 上用它编译。<​​/p>

当我想在 linux 中用它编译时:

Unable to find the requested Boost libraries.

Boost version: 1.65.1

Boost include path: pathtoproject/deps/boost

Could not find the following Boost libraries:

      boost_system

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.

所以我设置了 findboost 调试标志来理解为什么使用

 set(Boost_DEBUG 1)

在 CMake 中。我得到:

Boost_FOUND = 1

还有

Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc54-mt-1_65_1;boost_system-gcc54-mt;boost_system-mt-1_65_1;boost_system-mt;boost_system

这意味着 cmake 正在寻找名为“gcc54”的库。

但我的库名为“vc141”(msvc)。

那么它可以工作还是我需要 2 个 boost 版本才能在两个系统上工作。

最佳答案

您通常不能在编译器之间混合搭配,除非明确支持。在这种情况下,它非常不受支持。

关于c++ - 可以在linux程序中使用带有msvc的在windows上构建的lib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46625017/

相关文章:

c++ - 在 C++ 中执行 shell 命令时强制环境 bash

windows - 为什么在使用 Vagrant 配置 Windows 7 VM 时 Chocolatey 无法安装?

case 值为reinterpret_cast(string) 的 C++ switch 语句

c++ - Qt在不同操作系统下如何处理不同的事件序列?

c++ - 如何在 Visual Studio 解决方案中定义默认项目设置

c++ - 找到最接近的斐波那契数

linux - 如何从染色体 :position numbers? 中删除前导零

linux - 用于协处理外设的 Linux 设备驱动程序的良好接口(interface)是什么

c++ - 带有字符串变量指令的 C/C++ 内联汇编程序

c++ - QT中直接写入设备