如何为新安装的Boost添加编译器包含路径和链接器库路径?

发布于 2024-10-01 11:55:02 字数 506 浏览 1 评论 0原文

我有 RHEL 5.2,安装了 Boost 1.33。 我下载了boost_1_44_0.tar.bz2。并建造了它。完成后,它显示:

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /home/dfe/Archive/boost_1_44_0

The following directory should be added to linker library paths:

    /home/dfe/Archive/boost_1_44_0/stage/lib
  1. 如何添加上述包含路径?
  2. 当我执行“rpm -q boost”时,它显示 boost-1.33.1-10.el5。当我安装了 1.44 版本后,为什么会这样?
  3. 有没有更好的方法来安装最新版本的Boost?

I have RHEL 5.2, with Boost 1.33 installed.
I downloaded boost_1_44_0.tar.bz2. and built it. On completion it showed:

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /home/dfe/Archive/boost_1_44_0

The following directory should be added to linker library paths:

    /home/dfe/Archive/boost_1_44_0/stage/lib
  1. How do I add the above mentioned include paths?
  2. When I do "rpm -q boost", it shows boost-1.33.1-10.el5. Why is that so, when I've installed version 1.44?
  3. Is there a better way to install the latest version of Boost?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

初心未许 2024-10-08 11:55:02

在 Linux 系统上安装软件总是需要三个步骤:

  1. 配置 —“检查”
  2. make —“在当前目录中构建软件”
  3. make install —“将文件复制到系统,以便其他软件可以使用该软件”

您可能做了相当于make 但没有执行与 make install 相同的操作。 需要运行

sudo ./b2 install

运行./b2

There are always three steps to install software on Linux systems:

  1. configure — "check"
  2. make — "build software in current directory"
  3. make install — "copy files to the systems so the other software can use this software"

You likely did the equivalent of make but did not do the equivalent of make install. You need to run

sudo ./b2 install

after running ./b2

栀梦 2024-10-08 11:55:02

只需将路径添加到您的 .bashrc 或 .profile (或任何能让您漂浮的东西),如下所示:

export LIBS="-L/home/dfe/Archive/boost_1_44_0/stage/lib"
export CPPFLAGS="-I/home/dfe/Archive/boost_1_44_0"

Just add the paths to your .bashrc or .profile (or whatever floats your boat) like this:

export LIBS="-L/home/dfe/Archive/boost_1_44_0/stage/lib"
export CPPFLAGS="-I/home/dfe/Archive/boost_1_44_0"
§对你不离不弃 2024-10-08 11:55:02

您必须将这些目录包含到用于构建应用程序的 makefile 中

CC -I/home/dfe/Archive/boost_1_44_0 -L/home/dfe/Archive/boost_1_44_0/stage/lib yourprogram.cpp

-I 选项 将 dir 添加到搜索 #include 文件的目录列表中。

-L 选项将 dir 添加到链接器搜索库的目录列表中

CC 是 sun 编译器...

You have to include these directories into makefile which you would use to build your application

CC -I/home/dfe/Archive/boost_1_44_0 -L/home/dfe/Archive/boost_1_44_0/stage/lib yourprogram.cpp

-I option Adds dir to the list of directories that are searched for #include files.

-L option adds dir to the list of directories searched for libraries by linker

CC is sun compiler...

趁微风不噪 2024-10-08 11:55:02

首先,我删除了现有的 boost rpm 使用

rpm -e boost-1.33.1-10.el5

显示消息“错误:“boost”指定多个包”

然后尝试:(

rpm -e --allmatches boost

我不记得我是否输入了“boost”或“boost-1.33.1-10.el5” ')

显示了具有依赖项的包。
我做了:

rpm -e [packagename1]
rpm -e [packagename2]

等等,然后做了:

rpm -e --allmatches

这从我的系统中完全消除了提升。

然后我使用 tar -xvjf boost_1_44_0.tar.bz2 提取了 boost_1_44_0.tar.bz2 并运行 bootstrap:

./bootstrap.sh

然后运行 ​​bjam 为:

./bjam install

就是这样! Boost 安装在我的系统上,并且我在编译程序时不必指定任何链接器选项!耶!
现在“rpm -q boost”命令显示没有安装任何软件包。

First, I removed the existing boost rpm using

rpm -e boost-1.33.1-10.el5

A message is displayed saying "error: "boost" specifies multiple packages"

Then tried:

rpm -e --allmatches boost

(I don't remember whether I typed 'boost' or 'boost-1.33.1-10.el5')

The packages with dependencies were shown.
I did:

rpm -e [packagename1]
rpm -e [packagename2]

and so on and then did:

rpm -e --allmatches

This erased boost completely from my system.

Then I extracted boost_1_44_0.tar.bz2 using tar -xvjf boost_1_44_0.tar.bz2 and ran bootstrap with:

./bootstrap.sh

Then ran bjam as:

./bjam install

That's it! Boost got installed on my system, and I didn't have to specify any of the linker options while compiling programs! Yay!
Now the 'rpm -q boost' command shows that there is no package installed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文