如何将Armadillo与Eclipse链接 [英] How to link Armadillo with Eclipse

查看:153
本文介绍了如何将Armadillo与Eclipse链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Armadillo与Eclipse结合使用.但是,链接链接Armadillo的所有说明均针对Visual Studio.现在,我按照 Armadillo库的自述文件中概述的说明进行操作.我在project(right click)->properties->C/C++ Build->Settings->Cross G++ Compiler->Includes->Inlcude paths(-I)中添加了Armadillo包含文件夹,然后在project(right click)->properties->C/C++ Build->Settings->Cross G++ Linker->Libraries->Library search path (-L)中添加了librarys文件夹(库文件夹包含lapack和blas .lib和.dll文件).

I want to use Armadillo with Eclipse. However all the instructions to link Armadillo is given for Visual Studio. Now I followed the instructions outlined in the ReadMe file of the Armadillo library. I added the Armadillo include folder in project(right click)->properties->C/C++ Build->Settings->Cross G++ Compiler->Includes->Inlcude paths(-I) and then I added the libraries folder (The library folder contain lapack and blas .lib and .dll files) in project(right click)->properties->C/C++ Build->Settings->Cross G++ Linker->Libraries->Library search path (-L).

但是,当我在Eclipse中编译代码时,会出现错误

However when I compile the code in the Eclipse I get the error

..... armadillo_bits/lapack_wrapper.hpp:37:对'dgetrf_'的未定义引用.

.....armadillo_bits/lapack_wrapper.hpp:37: undefined reference to `dgetrf_'.

难道不应该只是在库文件夹中搜索.lib文件,并在编译过程中包括它们吗?对于此事的任何帮助,我们将不胜感激.

Shouldn't it simply search for .lib files in the library folder and include them during compiling? I would appreciate any help regarding this matter.

关于, TM

推荐答案

可以将Armadillo库链接到Eclipse项目,而您即将完成!它与任何其他库几乎相同.

Linking the Armadillo library to an Eclipse project can be done and you were about to do it ! It's pretty much the same as for any other library.

在项目的属性中:

  • GCC C ++编译器->包含:将文件armadillo(声明了名称空间arma的路径)添加到包含搜索路径(选项-I).示例:/home/alpha/soft/armadillo-4.400.1/include

  • GCC C++ Compiler -> Includes : add the path to the file armadillo (where namespace arma is declared) to the include search path (option -I). Example : /home/alpha/soft/armadillo-4.400.1/include

GCC C ++链接器->库:在库搜索路径(选项-L)中将路径添加到文件libarmadillo.so...,例如:/home/alpha/soft/armadillo-4.400.1.将armadillolapackblasm作为库添加(选项-l). m用于数学.

GCC C++ Linker -> Libraries : add the path to the file libarmadillo.so... in the library search path (option -L) Example : /home/alpha/soft/armadillo-4.400.1 . Add armadillo, lapack, blas and m as libraries (option -l). m is for math.

以下是eclipse产生的对编译器和链接器的调用:

Here are the calls to the compiler and the linker as produced by eclipse :

make all 
Building file: ../src/armaeclip.cpp
Invoking: GCC C++ Compiler
g++ -I/home/alpha/soft/armadillo-4.100.1/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/armaeclip.d" -MT"src/armaeclip.d" -o "src/armaeclip.o" "../src/armaeclip.cpp"
Finished building: ../src/armaeclip.cpp



Building target: armaeclip
Invoking: GCC C++ Linker
g++ -L/home/alpha/soft/armadillo-4.100.1 -o "armaeclip" ./src/armaeclip.o   -larmadillo -lblas -lm -llapack
Finished building target: armaeclip
**** Build Finished ****

运行代码时,您可能会得到类似:

As you run the code, you might get something like :

错误:det():需要启用ATLAS或LAPACK 抛出'std :: logic_error'实例后终止调用 what():det():需要启用ATLAS或LAPACK 放弃(弃用核心)

error: det(): use of ATLAS or LAPACK needs to be enabled terminate called after throwing an instance of 'std::logic_error' what(): det(): use of ATLAS or LAPACK needs to be enabled Abandon (core dumped)

为避免此问题,请遵循犰狳的常见问题解答的建议:取消注释在文件/home/alpha/soft/armadillo-4.100.1/include/config.hpp中并重建您的项目.

To avoid this problem, follow the advise of the faq of Armadillo : uncomment #define ARMA_USE_LAPACK in file /home/alpha/soft/armadillo-4.100.1/include/config.hpp and rebuild your project.

这篇关于如何将Armadillo与Eclipse链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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