0
我試圖編譯下面的代碼:http://www-personal.umich.edu/~mejn/dcbm/KLOptimization.cppc + +編譯 - GSL在x86_64
但我從收到以下錯誤消息G ++:
> Undefined symbols for architecture x86_64: "_gsl_rng_uniform_int",
> referenced from:
> Initialize() in ccDEqovL.o
> _main in ccDEqovL.o "_gsl_rng_default_seed", referenced from:
> _main in ccDEqovL.o "_gsl_rng_default", referenced from:
> _main in ccDEqovL.o "_gsl_rng_alloc", referenced from:
> _main in ccDEqovL.o "_gsl_rng_name", referenced from:
> _main in ccDEqovL.o "_gsl_rng_get", referenced from:
> _main in ccDEqovL.o "_gsl_rng_uniform", referenced from:
> _main in ccDEqovL.o "ComputeVI()", referenced from:
> _main in ccDEqovL.o "ComputeNMI()", referenced from:
> _main in ccDEqovL.o "_gsl_rng_free", referenced from:
> _main in ccDEqovL.o ld: symbol(s) not found for architecture x86_64
我的MacBook Air,運行iOS 10.7.3 。 g ++是i686-apple-darwin11-llvm-g ++ - 4.2。
==> Downloading http://ftpmirror.gnu.org/gsl/gsl-1.15.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gsl/1.15
==> make
==> make install
Warning: m4 macros were installed to "share/aclocal".
Homebrew does not append "/usr/local/share/aclocal"
to "/usr/share/aclocal/dirlist". If an autoconf script you use
requires these m4 macros, you'll need to add this path manually.
==> Summary
/usr/local/Cellar/gsl/1.15: 237 files, 7.0M, built in 81 seconds
什麼對象是_gsl_rng_uniform_int?你是否將它與'ccDEqovL.o'鏈接? – 2012-03-14 21:02:58
看起來你忘了鏈接GSL庫。當你編譯時,你的命令行是否包含'-lgsl'(我相信這是需要的)? – 2012-03-14 21:04:07
...只是因爲我有時會問這個問題 - 實際上是否已經手動將路徑「/ usr/local/share/aclocal」添加到「/ usr/share/aclocal/dirlist」? – 2012-03-14 21:07:19