C++编译-x86_64上的GSL
C++ compile - GSL on x86_64
我正在尝试编译以下代码:http://www-personal.umich.edu/~mejn/dcbm/KLOptimization.cpp
但我从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。
我使用"brew-install-GSL"安装了GSL,它给出了以下输出:
==> 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在库路径中)。
相关文章:
- Linux的Cpp上的计时器
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- 物理键盘上的触发器按键
- 如何加载(或映射)文件部分的最大大小,但适合在Windows上的RAM
- SSL上的`curl_easy_send`和`curl_asy_recv`:如何处理`CURLE_AGAIN`
- PowerPC ppc64le上的Gcc Woverloaded虚拟错误
- 为什么在Windows上的VS 2019和Clang 9中"size_t"在没有标题的情况下工作
- 集合上的输出迭代器:assign和increment迭代器
- Cuda C++:设备上的Malloc类,并用来自主机的数据填充它
- 为什么我在leetcode上收到AddressSanitizer:地址0x602000000058上的堆缓冲区溢出错误
- 对于set上的循环-获取next元素迭代器
- 如何从棋盘上的箱号中找到行和列
- 为什么除非添加括号,否则构造函数上的模板替换会失败?
- if数组上的随机数
- 向量上的线性搜索
- 位阵列上的快速AND运算
- 无法将 GLFW 库与 Ubuntu 18.04 上的头文件链接
- 为什么一个向量上的多线程操作很慢
- 64位机器上的C++内存对齐
- C++编译-x86_64上的GSL