问题描述
我是mac用户,正在尝试安装和导入C ++ Armadillo库.这是我到目前为止已执行的步骤:
I'm a mac user and am trying to install and import C++ Armadillo library. Here are the steps I've had so far:
1)我从其网站下载了Armadillo库.
1) I downloaded the Armadillo library from its website.
2)我浏览了下载文件中的Readme.txt文件,解释了如何安装它.
2) I went over the Readme.txt file in the download file explaining how to install it.
3)我使用CMake将犰狳下载文件转换为二进制文件.
3) I used CMake to make the armadillo download files into binary files.
4)然后,使用终端和sudo make install代码,安装了二进制代码,它们生成了一些类似库的"文件:libarmadillo.4.0.2.dylib,libarmadillo.4.dylib,lib armadillo.dylib
4) Then by using terminal and the code sudo make install, I installed the binary codes and they generated some "library-like" files: libarmadillo.4.0.2.dylib, libarmadillo.4.dylib, lib armadillo.dylib
5)然后我将所有这些文件复制到/url/lib目录.
5) I then copied all these files into /url/lib directory.
6)现在,我的Xcode程序正在运行,并且试图通过include命令包括armadillo库.问题是Xcode突出显示了这一行,并显示找不到armadillo文件".谁能帮我解决这个问题?
6) Now I have my Xcode program running and I'm trying to include the armadillo library via the include command. The problem is Xcode highlights this line and it says "armadillo file not found". Could anyone please help me solve this issue?
非常感谢
推荐答案
您需要在构建设置中设置以下内容:
You need to set the following things in your build settings:
- 标题搜索路径:/path/to/armadillo/include(例如/url/lib/armadillo/include之类的东西)
这是编译源代码所需的全部.但是,为了使程序链接,您还需要满足以下条件:
This is all you need for your source to compile. However, in order to get your program to link, you will also need the following:
- 图书馆搜索路径:/path/to/armadillo/libraries(例如/url/lib/armadillo/lib之类的东西)
- 其他链接器标志:-larmadillo(或:使用GUI将armadillo库添加到您的Link构建阶段)
如果您不确定如何正确构建和安装犰狳(例如,配置时使用哪个前缀),我强烈建议您使用软件包管理器(如 MacPorts )来为您做这件事,
If you're not exactly sure how to properly build and install armadillo (e.g. which prefix to use when configuring), I highly recommend using a package manager such as MacPorts to do it for you,
- 从此处 安装端口
- 运行以下命令:
- Install port from here
- run the following command:
这篇关于将Armadillo C ++库导入Xcode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!