[英]Nauty and Traces on Mac OS X
我正在嘗試使用代碼 Nauty 和 Traces http://pallini.di.uniroma1.it/ 。 但是當我編譯一個例子時,說nautyex8.c(由包提供),出現了以下錯誤:
Undefined symbols for architecture x86_64: "_alloc_error", referenced from: _main in nautyex8-54d9da.o "_densenauty", referenced from: _main in nautyex8-54d9da.o "_dispatch_graph", referenced from: _main.options in nautyex8-54d9da.o "_nauty_check", referenced from: _main in nautyex8-54d9da.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
我使用的是 Mac OS X Yosemite (10.10.5) 和 Xcode(7.1 版)。 我相信代碼中沒有錯誤,因為它們被廣泛使用,所以我猜問題出在我的系統設置上。
非常感謝!
我剛剛打開了一個拉取請求,讓brew install nauty
在 OS X 上工作: https : //github.com/Homebrew/homebrew-core/pull/48701
在此之前,從 Nauty/Traces 2.6r12 開始,您將如何在 OS X 上構建 nautyex8.c。
第 1 步是下載代碼並構建庫:
wget http://pallini.di.uniroma1.it/nauty26r12.tar.gz
tar zxvf nauty26r12.tar.gz
cd nauty26r12
./configure
make
ls -l nauty.a
第 2 步是編譯 nautyex8.c 並將其鏈接到您剛剛構建的庫:
gcc -O3 nautyex8.c nauty.a
./a.out
您可能忘記將“ nauty.a
”放在編譯器命令行的末尾。 如果我也這樣做,我會得到:
gcc -O3 nautyex8.c
Undefined symbols for architecture x86_64:
"_alloc_error", referenced from:
_main in nautyex8-05f086.o
"_densenauty", referenced from:
_main in nautyex8-05f086.o
"_dispatch_graph", referenced from:
_main.options in nautyex8-05f086.o
"_nauty_check", referenced from:
_main in nautyex8-05f086.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
完全符合你描述的症狀。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.