安装C++编译器
查看自己的C++编译器版本
cmake --version
cmake version 3.22.1
如果没有安装cmake,那么可以使用指令自行安装
sudo apt-get install cmake
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev
安装opencv
通过官网,使用代码安装opencv https://github.com/opencv/opencv/releases
我选择了opencv3.4.15,选择最后的Source.code(tar.gz)进行下载。
下载完毕后放入合适的路径,进行解压。
之后创建release文件夹,并进行编译
mkdir release
cd release
cmake ..
sudo make
sudo make install
验证opencv是否安装成功
#include <iostream>
#include <opencv2/opencv.hpp>int main() {std::cout << "OpenCV version: " << CV_VERSION << std::endl;return 0;
}
卸载opencv
sudo make uninstall
cd ..
sudo rm -r build
安装lapack
确定已安装gfortran
sudo apt-get install gfortran
源码安装lapack,下载并解压
https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.9.1.tar.gz
进行编译
cd lapack-3.9.1
mkdir build
cd build
cmake ..
make -j7
sudo make install
sudo ldconfig
cd ..
sudo cp LAPACKE/include/*.h /usr/local/include/
测试lapack 报错
#include <stdio.h>
#include <lapacke.h>int main (int argc, const char * argv[])
{double a[5*3] = {1,2,3,4,5,1,3,5,2,4,1,4,2,5,3};double b[5*2] = {-10,12,14,16,18,-3,14,12,16,16};lapack_int info,m,n,lda,ldb,nrhs;int i,j;m = 5;n = 3;nrhs = 2;lda = 5;ldb = 5;info = LAPACKE_dgels(LAPACK_COL_MAJOR,'N',m,n,nrhs,a,lda,b,ldb);for(i=0;i<n;i++){for(j=0;j<nrhs;j++){printf("%lf ",b[i+ldb*j]);}printf("\n");}return(info);
}
安装
没有写完