Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/136.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++ 编译boostc++;11 clang mac找不到CSTDEF_C++_Boost_C++11_Clang - Fatal编程技术网

C++ 编译boostc++;11 clang mac找不到CSTDEF

C++ 编译boostc++;11 clang mac找不到CSTDEF,c++,boost,c++11,clang,C++,Boost,C++11,Clang,我无法在MacOSX10.8.2上编译带有Clang3.1的boost 这就是我所做的: ./bootstrap.sh --with-toolset=clang ./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" 我也试过不用计时、测试、波动和信号。 我尝试了一个user-config.jam using clang-darwin 这是我对几乎每个文件的错误: /boost/co

我无法在MacOSX10.8.2上编译带有Clang3.1的boost

这就是我所做的:

./bootstrap.sh --with-toolset=clang
./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++"
我也试过不用计时、测试、波动和信号。 我尝试了一个user-config.jam

using clang-darwin
这是我对几乎每个文件的错误:

/boost/config/select_stdlib_config.hpp:18:12: fatal error: 'cstddef' file not found
这有点像

谢谢:-)

更新: 我确实安装了最新的Xcode 4.5.2和命令行工具

以下是控制台输出的一部分:

Kikohs:trunk kikohs$ ./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++"
Performing configuration checks

- 32-bit                   : no
- 64-bit                   : yes
- x86                      : yes
- has_icu builds           : no
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
    - gcc visibility           : yes
    - long double support      : no
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.

构建Boost C++库.< /P>

- iconv (libc)             : no
- iconv (separate)         : yes
- icu                      : no
- icu (lib64)              : no
组件配置:

- atomic                   : building
- chrono                   : building
- context                  : building
- date_time                : building
- exception                : building
- filesystem               : building
- graph                    : building
- graph_parallel           : building
- iostreams                : building
- locale                   : building
- math                     : building
- mpi                      : building
- program_options          : building
- python                   : building
- random                   : building
- regex                    : building
- serialization            : building
- signals                  : building
- system                   : building
- test                     : building
- thread                   : building
- timer                    : building
- wave                     : building

...patience...
...patience...
...patience...
...patience...
...found 8672 targets...
...updating 1127 targets...
common.mkdir bin.v2/libs/atomic
common.mkdir bin.v2/libs/atomic/build
common.mkdir bin.v2/libs/atomic/build/clang-darwin-4.2.1
common.mkdir bin.v2/libs/atomic/build/clang-darwin-4.2.1/debug
clang-darwin.compile.c++ bin.v2/libs/atomic/build/clang-darwin-4.2.1/debug/lockpool.o
In file included from libs/atomic/src/lockpool.cpp:1:
./boost/atomic.hpp:10:10: fatal error: 'cstddef' file not found
#include <cstddef>
     ^
1 error generated.

"clang++" -x c++ -O0 -g -std=c++11 -stdlib=libc++ -O0 -fno-inline -Wall -g -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1 -DBOOST_ATOMIC_SOURCE -I"." -c -o "bin.v2/libs/atomic/build/clang-darwin-4.2.1/debug/lockpool.o" "libs/atomic/src/lockpool.cpp"
-原子:建筑
-时钟:建筑物
-背景:建筑
-日期和时间:建筑
-例外情况:建筑
-文件系统:构建
-图表:建筑
-图形并行:建筑
-iostreams:建筑
-地点:大厦
-数学:建筑
-mpi:建筑
-项目选项:建筑
-python:构建
-随机:建筑
-正则表达式:建筑物
-序列化:构建
-信号:建筑
-系统:建筑
-测试:建筑
-主题:建筑
-计时器:建筑物
-波浪:建筑物
……耐心。。。
……耐心。。。
……耐心。。。
……耐心。。。
…找到了8672个目标。。。
…正在更新1127个目标。。。
common.mkdir bin.v2/libs/atomic
common.mkdir bin.v2/libs/atomic/build
common.mkdir bin.v2/libs/atomic/build/clang-darwin-4.2.1
common.mkdir bin.v2/libs/atomic/build/clang-darwin-4.2.1/debug
编译C++达尔文bin。v2/LIBS/Actudio/Bug/CLAN-DARWEN 4.2.1/Debug /CopyPo.O
在libs/atomic/src/lockpool.cpp中包含的文件中:1:
./boost/atomic.hpp:10:10:致命错误:未找到“cstdef”文件
#包括
^
生成1个错误。
“CLAN+++”-X0+-G0+ST-C++=C++ 11——STDLIB= LIBC++-O0-FNO内嵌-G-DBOSTSTYLALL NoYLIB=1 -DBOSTSTORATIOMIC,DynLink=1—DBOOSTSTORIMAICIOX源-I“.-”-O“bin”.V2/LIBS/Buff/Bug/CLAN-DARWEN 4.2.1/Debug /LoopCur.O”“LIBS/Actodia/SrC/LoopCur.CPP”

看起来您忘了在clang旁边安装libc++头文件


如果您不想在安装头文件时遇到麻烦,请尝试使用Apple发布的clang版本,作为命令行工具包的一部分;它经过了更多的测试,并且已经正确设置。

我终于在几个小时后解决了我的问题

自制软件弄乱了我的路径,出于某种原因,我的叮当声找不到libc++头文件

有一个bug是boost 1.52

我必须编辑文件:

boost/config/stdlib/libcpp.hpp
并修补它:

#if _LIBCPP_VERSION < 1002 
#   define BOOST_NO_CXX11_NUMERIC_LIMITS 
#endif 
\if\u LIBCPP\u版本<1002
#定义增压\u无\u CXX11 \u数值\u限制
#恩迪夫

现在boost正在正确构建…

对于Ubuntu 16.04,我能够使用gcc使用c++11构建boost:

cd/home/user/install/boost/boost_1_54/

./bootstrap.sh——使用toolset=gcc

./b2 toolset=gcc cxflags=“-std=c++11-I/usr/include/c++/5/-I/usr/include/x86_64-linux-gnu/c++/5/”

mkdir../2

./b2安装--前缀=../2/

用于生成我的程序的命令:

g++-std=c++11-O2 fprint.cpp-o fprint-I/home/user/install/boost/2/include/-L/home/user/install/boost/2/lib/-lboost\u regex-lboost\u程序选项

在此之前,命令是:

g++-std=c++11 fprint.cpp-o fprint-lboost\u regex-lboost\u program\u选项

,但是这个旧命令(以前在旧操作系统和boost/etc中很好地工作)不再工作了 " 未定义对boost::re_detail_106501的引用 " (由/tmp/cc0Zn8lo.o:In函数'boolboost::regex_search…)表示)


((同样,如果我没有为./b2使用“-I/usr/include/c++/5/-I/usr/include/x86_64-linux-gnu/c++/5/”,那么在构建boost期间的错误是“找不到cstdef”,因此与此票据的主题完全相同))

我已经更正了您的标题,将
cstdef.h
更改为
cstdef
Homebrew现在可以选择使用c++11构建boost,boost由Homebrew:-)修补。请注意,如果您在项目旁边构建boost,我认为travis ci没有办法做到这一点。如果有人找到办法,让我知道,但我认为没有办法,因为特拉维斯·西的《叮当声》已经过时了。