2012-02-05 109 views
0

我最近在MacOSX 10.7上使用MacPorts安裝了boost 1.48。雖然我能夠編譯boost文檔中給出的一些示例,但我在這個失敗(http://www.boost.org/doc/libs/1_48_0/libs/bimap/example/step_by_step.cpp)。以下是錯誤消息:無法在Mac上使用boost進行編譯程序

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-包括-DIR =的/ usr /包括/ C++/4.2.1 線程模型:POSIX gcc版本4.2.1(基於蘋果公司籌建5658)(LLVM建立2336.1.00)

請幫我編譯一下。

感謝

+0

從boost網站複製代碼時,這是一個愚蠢的錯誤。我已經糾正了這個問題,現在它運行良好。 – sank 2012-02-05 22:05:44

回答

0

並不意味着是一個解決方案,但我只是想這與升壓發佈分支(這將是1.49推出),以及它的工作就好了。 並與1.47版本。 (我沒有安裝1.48)

相同的編譯器。

+1

這應該可能是一條評論。 – 2012-02-05 04:37:16