Unable to compile program using boost on Mac

I recently installed boost 1.48 on my MacOSX 10.7 using MacPorts. While I am able to compiler some examples given in boost documentation, I am failing in this one (http://www.boost.org/doc/libs/1_48_0/libs/bimap/example/step_by_step.cpp). Here is the error message:

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

Here are the details about the compiler

Using built-in specs.
Target: i686-apple-darwin11
Configured with: /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 Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

Please help me compile it.

Thanks


Not meant to be a solution, but I just tried this with the Boost release branch (what will be 1.49 soon), and it worked just fine. And with the 1.47 release. (I don't have 1.48 installed)

Same compiler.

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

上一篇: m32在64位MacOs Lion上

下一篇: 无法在Mac上使用boost进行编译