将armadillo库添加到linux中的g ++编译器(add armadillo libraries to g++ compiler in linux)

系统教程 行业动态 更新时间:2024-06-14 16:57:18
将armadillo库添加到linux中的g ++编译器(add armadillo libraries to g++ compiler in linux)

我试图在unix集群中安装一个C ++库( armadillo ),我没有root权限。

我通过运行以下make命令设法编译没有用户权限的C ++库:

make install DESTDIR=my_usr_dir

但是在犰狳自述文件中它说:

其中“my_usr_dir”用于存储C ++标头和库文件。 确保将C ++编译器配置为使用此目录中的子目录。

犰狳用来安装库的编译器是gcc-4.8.1。 我不确定编译器的安装位置,但是当我在unix集群中启动会话时它已加载。

安装armadillo之后,我正在尝试编译使用armadillo库的开源代码。 这个开源代码也有一个makefile。

但是,当我转到开源代码并输入时:

make

它叫g ++。 如何确保g ++能够识别以前安装在my_usr_dir中的armadillo库?

目前,如果我转到src然后输入make,我会收到以下错误:

opencode.cpp:28:21: fatal error: armadillo: No such file or directory #include <armadillo> ^ compilation terminated. make: *** [mmcollapse] Error 1

I am trying to install a C++ library (armadillo) in a unix cluster where I do not have root permissions.

I managed to compile the C++ libraries without user permissions by running the following make command:

make install DESTDIR=my_usr_dir

But then in the armadillo readme file it says:

where "my_usr_dir" is for storing C++ headers and library files. Make sure your C++ compiler is configured to use the sub-directories present within this directory.

The compiler the armadillo uses to install the libraries is gcc-4.8.1. I am not sure where the compiler was installed but it's loaded when I start my session in the unix cluster.

After installing armadillo I am trying to compile open source code that uses the armadillo libraries. This open source code also has a makefile.

However, when I go to the open source code and I type in:

make

it calls g++. How can I make sure g++ will recognize the armadillo libraries previously installed in my_usr_dir?

Currently I get the following error if I go to src and then type make:

opencode.cpp:28:21: fatal error: armadillo: No such file or directory #include <armadillo> ^ compilation terminated. make: *** [mmcollapse] Error 1

最满意答案

您可以使用

alias gcc="gcc -I./my_usr_dir/include -L./my_usr_dir/lib"

等等.bashrc文件中。 这样,无论何时在命令行上调用gcc,都会在命令行中输入的每个其他参数之前添加标志。

you can use

alias gcc="gcc -I./my_usr_dir/include -L./my_usr_dir/lib"

and so on in your .bashrc file. In that way, whenever you invoke gcc on the command line, the flags will be added before every other argument you enter on the command line

更多推荐

本文发布于:2023-04-12 20:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/71b9ca91873c13c198aef89c2a9a18b4.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编译器   linux   armadillo   compiler   libraries

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!