c++ - 如何创建简单的 Boost.Build make 文件,其中包含指向我在 Windows 和 Linux 上使用的库的链接?

标签 c++ boost configuration makefile bjam

main.cpp 应该是可执行的 C++ 应用程序。这取决于

  • 需要先编译 Lib1(在 main.cpp 之前)project-lib(lib1.h 和 lib1.cpp 在一些单独的文件夹中)
  • “Lib2.lib”及其依赖给定的预编译库(例如跨平台 OpenCV)

我需要它在 Windows 和 Linux 上工作,如果可能的话还需要在 Mac OS 上工作

为 windows 找到:看here - "Common tasks"第 26 页

exe hello : hello.cpp some_library.lib /some_project//library
          : <threading>multi
          ;

我希望有更好的 - 从 Boost 创作者那里获得更易读的语法......顺便说一句

到底是干什么的

On Windows, if an application uses shared libraries, and both the application and the libraries are built using Boost.Build, it is not possible to immediately run the application, because the PATH environment variable should include the path to the libraries. It means you have to either add the paths manually, or have the build place the application and the libraries into the same directory.

是什么意思?我不能有一个包含 2 个嵌套项目的项目 - 一个用于 .lib,一个用于使用该 .lib 的应用程序?

有了这个,我看到了如何连接 1 .lib 但如何将文件夹与它们连接?以及如何连接包括?当我转向 Linux 时,会发生什么变化?

我的 bjam make/config 文件应该是什么样的?

最佳答案

听起来您想要一个适用于跨平台(多操作系统)场景的框架。

最简单的选择是安装 cygwin 并为 linux 创建一个标准的 makefile。在 cygwin 环境中编译以生成等效的 Windows。

您将节省大量创建联编文件的时间。

另一个选项是 mksnt。

关于c++ - 如何创建简单的 Boost.Build make 文件,其中包含指向我在 Windows 和 Linux 上使用的库的链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4998989/

相关文章:

c++ - 函数参数包后跟其他参数的模板参数推导

c++ - 如何使用 boost::filesystem 检查文件是常规文件还是符号链接(symbolic link)?

java - 使用 Spring Security 3 实现 CAS

c# - 测试 WCF URL 的可用性

configuration - 如何在 vim 中覆盖 ~/.vim 和 ~/.vimrc 路径(但不能覆盖其他路径)?

c++ - SLEEP: (Sleep or usleep) 不是在 Linux 中挂起我线程中的所有内容,而是在 Windows 中?为什么?

c++ - 函数模板调用中的<未解析的重载函数类型>

c++ - 为什么是const指针而不是指向const的指针?

c++ - 在 Visual Studio 2010 中使用 boost::test - 如何查看测试输出?

c++ - Boost::message_queue::receive/send 不适用于最新版本