Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/162.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 安装Boost C+;时出现问题+;_C++_Macos_Boost_Installation - Fatal编程技术网

C++ 安装Boost C+;时出现问题+;

C++ 安装Boost C+;时出现问题+;,c++,macos,boost,installation,C++,Macos,Boost,Installation,现在,我正试图在我的电脑上安装boost,一台运行Mavericks的Mac电脑。我已下载boost并将其解压缩到目录中 $HOME/local/src/ 解压缩后,我将其移动到boost源目录中的一个新目录: tools/build/v2 然后我执行了死刑 ./boostrap.sh --with-toolset=gcc 一切都很顺利。下一步是问题开始的地方:在src文件中,我执行了以下命令: tools/build/v2/boost_1_57_0/b2 install --prefix

现在,我正试图在我的电脑上安装boost,一台运行Mavericks的Mac电脑。我已下载boost并将其解压缩到目录中

$HOME/local/src/
解压缩后,我将其移动到boost源目录中的一个新目录:

tools/build/v2
然后我执行了死刑

./boostrap.sh --with-toolset=gcc
一切都很顺利。下一步是问题开始的地方:在src文件中,我执行了以下命令:

tools/build/v2/boost_1_57_0/b2 install --prefix=PREFIX --toolset=gcc --with-program_options --with-filesystem
然后返回以下错误:

Unable to load Boost.Build: could not find "boost-build.jam"

---------------------------------------------------------------
BOOST_ROOT must be set, either in the environment, or 
on the command-line with -sBOOST_ROOT=..., to the root
of the boost installation.
它说找不到boost-build.jam,但我在Finder中打开文件夹,我看到boost-build.jam就在我的boost\u 1\u 57\u 0文件夹中。如何执行此命令?我做错什么了吗?如果它运行正确,我应该有一个前缀/include目录,其中包含boost的头文件。我该怎么做才能得到这个?以下是Boost网站的链接,如果有帮助的话:

另外,我已经找到了关于如何安装Boost的页面:

这个用户描述的方法是否会给出与上面的代码相同的结果,如果它运行正常的话?提前感谢。

安装brew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然后做:

brew install boost-build

之后,您将在
/usr/local/bin/bjam
中获得
bjam
可执行文件,感谢elyase的回复。我还找到了一种方法来解决上面发布的不使用brew的问题。我犯了一个错误,在我的src文件夹中创建了一个新的tools/build/v2文件夹——但是,我应该将cd刻录到下载的boost文件夹中的tools/build文件夹中。此外,在较新版本的boost中,没有v2文件夹,所以只需使用

tools/build/b2 install --prefix=PREFIX --toolset=gcc --with-program_options --with-filesystem

希望这能帮助那些不熟悉Mac的人(比如我)解决类似的问题。

我应该在哪个文件夹中安装boost build--src、v2或boost_1_57_0?brew将把它放在
/usr/local/ceral/boost build/
下好的--我用brew安装了,但我还是有点困惑。brew的boost build是用来替换我上面写的不起作用的代码,还是用来让我上面写的代码正常工作?我用文件系统再次运行了tools/build/v2/boost_1_57_0/b2 install--prefix=prefix--toolset=gcc--with-program_options--with-filesystem,它给了我同样的错误(对不起,我是Mac的新手,我的前两台计算机都是Dells)。brew安装应该替换您的代码,您不需要从源代码手动下载或编译,brew为您做这件事。