C ++ compile - GSL on x86_64 [英] C++ compile - GSL on x86_64

查看:119
本文介绍了C ++ compile - GSL on x86_64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译以下代码: http:// www- personal.umich.edu/~mejn/dcbm/KLOptimization.cpp

I am trying to compile the following code: http://www-personal.umich.edu/~mejn/dcbm/KLOptimization.cpp

但我从g ++得到以下错误消息:

But I get the following error message from 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 ++ is i686-apple-darwin11-llvm-g ++ - 4.2。

I have MacBook Air, running iOS 10.7.3. g++ is i686-apple-darwin11-llvm-g++-4.2.

我使用brew install gsl安装了GSL,它提供了以下输出:

I installed GSL using "brew install gsl", which gave the following output:

==> 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库。只需添加 -lgsl ,它应该工作(假设gsl在你的库路径)。

It seems you forgot to link the GSL library. Just add the -lgsl and it should work (assuming gsl is in your library path).

这篇关于C ++ compile - GSL on x86_64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆