使用单独的Boost库进行编译,而无需安装Boost [英] Compiling with individual Boost libraries, Without installing Boost

查看:171
本文介绍了使用单独的Boost库进行编译,而无需安装Boost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实现一些C ++代码,我想尽可能做到便携。我想要避免对需要root访问权限安装的库的依赖。此外,我宁愿避免在我的存储库中保存大型库的副本,我也不喜欢用户级安装库(只是因为我必须在多台计算机上手动安装它们)。

I'm implementing on some C++ code that I would like to make as portable as possible. I would like to avoid dependencies on libraries that require root access to install. Further, I'd prefer to avoid keeping copies of large libraries in my repository, and I would also prefer not to do user-level installations of libraries (simply because I'd have to manually install them on multiple computers.)

我想在我的项目中使用Boost的 normal_distribution 功能。我理解,安装Boost的典型方式需要一个 sudo apt-get sudo yum 类型的命令,但是在运行此代码的系统上没有根访问权限。为了解决这个问题,我想知道我是否可以简单地将Boost的 normal_distribution.cpp normal_distribution.hpp 在我的代码目录,并编译/链接我的代码与这些文件。

I would like to use the normal_distribution functionality from Boost in my project. I understand that the typical way to install Boost requires a sudo apt-get or sudo yum type of command, but I don't have root access on the systems where this code will run. To get around this, I'm wondering if I could simply place a copy of Boost's normal_distribution.cpp and normal_distribution.hpp in my code directory and compile/link my code with these files. Would this work?

读者可能想知道为什么我不是在TR1或C ++中使用 normal_distribution +11。答案是,我需要保持与一些大学管理的集群,仍然运行g ++ 4.1.x,这至少在我的经验不支持< TR1 / random>

Readers may wonder why I'm not just using the normal_distribution implementation in TR1 or C++11. The answer is that I need to maintain compatibility with some university-managed clusters that still run g++ 4.1.x, which (at least in my experience) doesn't support <TR1/random>.

推荐答案

我想, BCP(Boost Copy)正是根据您的情况编写的。

I imagine that BCP (Boost Copy) was written precisely with your situation in mind.

这篇关于使用单独的Boost库进行编译,而无需安装Boost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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