为什么我不能在 /usr/include 中安装 boost?
我正在尝试将 boost
安装到包含目录中,以避免在每个 g++ 编译器调用中使用 -I
标志,我使用以下命令行安装:./bjam - -prefix=/usr/include 安装
查看--prefix
值,它安装在/home/myusername
中,为什么? 提前致谢。
I'm trying to install boost
into include directory for avoid -I
flag use in each g++ compiler call,I installed using this command line: ./bjam --prefix=/usr/include install
see --prefix
value, it install in /home/myusername
, why?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要 root 权限才能安装在
/usr/include
中。事实上,你的系统不让你这么做,已经帮了你一个忙了。
--prefix
选项表示安装所有内容的位置 - 头文件、库、可执行文件、文档等。例如,头文件将安装在/ usr/include/include
,它不会出现在编译器的搜索路径中。免责声明::假设
./bjam --prefix=...
的行为与./configure --prefix=...
类似。我实际上并没有使用过bjam
。如果bjam
的--prefix
选项有其他含义,请纠正我。根据您的系统,您也许可以从存储库安装 Boost,而不是从源代码构建它。例如,对于 Debian 或 Ubuntu,诸如
sudo apt-get install libboost
之类的东西可能会起作用。请注意,我说过类似的话; Boost 似乎由许多包组成;
apt-cache search boost
,或者更好的是,进行 Google 搜索以了解如何在您的特定系统上安装 Boost。You would need root permissions to install in
/usr/include
.Actually your system has done you a favor by not letting you do that. The
--prefix
option says where to install everything -- headers, libraries, executables, documentation, etc. For example, the header files would be installed in/usr/include/include
, which is not going to be in your compiler's search path.Disclaimer:: This assume that
./bjam --prefix=...
behaves similarly to./configure --prefix=...
. I haven't actually usedbjam
. Ifbjam
's--prefix
option means something else, please correct me.Depending on your system, you may be able to install Boost from a repository rather than building it from source. For Debian or Ubuntu, for example, something like
sudo apt-get install libboost
might work.Note that I said something like that; it appears that Boost consists of a number of packages;
apt-cache search boost
, or better yet, do a Google search to see how to install Boost on your particular system.尝试运行
这样做应该以适当的权限运行
bjam
以安装到/usr/local/include
和/usr/local/lib
,两者它应该在你的搜索路径中......Try running
Doing this should run
bjam
with appropriate privileges to install to/usr/local/include
and/usr/local/lib
, both of which should be in your search path...