OpenBlas:使用Xcode时找不到CBLAS.H
使用CBLA时,我会遇到问题。我是新手使用C ++进行数字的新手,我知道OpenBlas是执行线性代数计算的著名库之一。我在M1 MacBook中使用BREW安装OpenBlas
。安装完成后,我按照输出指令简单地将这些命令键入终端。但是,当我使用以下示例测试OpenBlas时,
#include <iostream>
#include "cblas.h"
#include "lapacke.h"
using namespace std;
int main(){
float b[] = {3, 1, 3, 1, 5};
cblas_sasum(5, b, 1);
cout << "Program finished";
}
Xcode说致命错误:'CBLAS.H'文件找不到
。因此,我想知道如何解决这个问题。感谢任何评论。
I encounter a problem when using cblas. I am new to use C++ to do numerics and I know Openblas is one of the famous library to perform linear algebra computation. I use brew install openblas
in my M1 Macbook. When the installation finishes, I follow the output instruction by simply typing these commands in terminal. However, when I use the following example to test openblas,
#include <iostream>
#include "cblas.h"
#include "lapacke.h"
using namespace std;
int main(){
float b[] = {3, 1, 3, 1, 5};
cblas_sasum(5, b, 1);
cout << "Program finished";
}
Xcode says that fatal error: 'cblas.h' file not found
. Therefore, I am wondering how to solve this issue. I appreciate any comment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过几次反复试验后,我通过编写以下makefile来解决我的问题:
我跟随此 post 写一个makefile,它确实有效。要使用Xcode编译
main.cpp
文件,我们需要将链接添加到Xcode中。在此After several trial and error, I solve my problem by writing the following makefile:
I follow this post to write a makefile and it does work. To use Xcode to compile the
main.cpp
file, we need to add linker into Xcode. The instruction is discussed in this youtube video