无法在Mac上使用boost进行编译

我最近使用MacPorts在MacOSX 10.7上安装了boost 1.48。 虽然我能够编译boost文档中给出的一些示例,但我在这个失败(http://www.boost.org/doc/libs/1_48_0/libs/bimap/example/step_by_step.cpp)。 这是错误消息:

g++  -Wall -I/opt/local/include  -L/opt/local/lib   step_by_step.cpp   -o step_by_step
In file included from /usr/include/machine/_types.h:32,
                 from /usr/include/sys/_types.h:33,
                 from /usr/include/_types.h:27,
                 from /usr/include/unistd.h:71,
                 from /usr/include/c++/4.2.1/bits/os_defines.h:61,
                 from /usr/include/c++/4.2.1/bits/c++config.h:41,
                 from /usr/include/c++/4.2.1/cstddef:50,
                 from /opt/local/include/boost/config/select_stdlib_config.hpp:18,
                 from /opt/local/include/boost/config.hpp:40,
                 from step_by_step.cpp:7:
/usr/include/i386/_types.h:37: error: expected constructor, destructor, or type conversion before ‘typedef’
make: *** [step_by_step] Error 1

这里是关于编译器的细节

使用内置规格。
目标:i686-apple-darwin11
配置为:/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix = / Developer / usr / llvm-gcc-4.2 --mandir = / share / man --enable-languages = c,objc,c ++,obj-c ++ --program-prefix = llvm- --program-transform-name = / ^ [cg] [^ .-] * $ / s / $ /-4.2/ --with-slibdir = / usr / lib --build = i686-apple-darwin11 --enable-llvm = / private / var / tmp / llvmgcc42 / llvmgcc42-2336.1〜22 / dst-llvmCore / Developer / usr / local --program-prefix = i686-apple-darwin11- --host = x86_64-apple-darwin11 --target = i686-apple-darwin11 --with-gxx-include-dir = / usr / include / c ++ / 4.2.1线程模型:posix gcc版本4.2.1(基于Apple Inc. build 5658)(LLVM build 2336.1.00)

请帮我编译一下。

谢谢


这并不意味着是一个解决方案,但我只是用Boost发布分支(即将发布1.49版本)尝试了这一点,并且它工作得很好。 随着1.47发布。 (我没有安装1.48)

同一编译器。

链接地址: http://www.djcxy.com/p/85879.html

上一篇: Unable to compile program using boost on Mac

下一篇: Error installing ruby 1.9.3 from rvm on ubuntu 11.04