2016-04-27 317 views
0

我想編譯MultiNEAT項目(https://github.com/peter-ch/MultiNEAT)。我已經安裝了boost和boost-python,它位於/ usr/local/Cellar/boost。我還編輯了〜/ .bash_profile,將/usr/local/Cellar/boost/1.60.0_1/include添加到PATH。然而,當我試圖通過C++程序找不到boost

sudo python setup.py install 

編譯和安裝MultiNEAT我得到的問題:

running install 
running build 
running build_py 
running build_ext 
building '_MultiNEAT' extension 
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/Genome.cpp -o build/temp.macosx-10.11-intel-2.7/src/Genome.o -march=native -DUSE_BOOST_PYTHON -DUSE_BOOST_RANDOM -std=gnu++11 -g -Wall 
src/Genome.cpp:37:10: fatal error: 'boost/unordered_map.hpp' file not found 
#include <boost/unordered_map.hpp> 
    ^
1 error generated. 
error: command 'cc' failed with exit status 1 

所以我的問題是:我怎樣才能使程序發現Boost庫,併成功comiple MultiNEAT?我的系統是OS X Yosemite。謝謝!

回答

1

您必須更改編譯定義以包含boost頭文件。您可能需要將增強庫(及其目錄)添加到鏈接設置中。如果您發佈了構建應用程序的方式,我可以說更多。

+0

嗨@邁克爾,謝謝你的回答!我下載了MultiNEAT的代碼,並嘗試通過運行它提供的「sudo python setup.py install」的python腳本來構建應用程序,遵循http://multineat.com/download.html上的說明。我對CMake或cc等東西不太瞭解。我所知道的是該系統是通過setup.py文件構建的。 – Excalibur

+0

我在'setup.py'中看到的意思是你必須手動編輯它,並將你的BOOST頭文件和庫的位置添加到相關的命令中。爲此,有'extra_compile_args ='和'libraries ='表達式。 – GMichael

+0

是的,其實我試過了,比如在「extra_compile_args =」表達式中添加'-DBOOST_ROOT =/usr/local/Cellar/boost/1.60.0_1/include /',但仍然無法編譯。 – Excalibur