1、eigen安装
安装命令如下:
sudo apt-get update
sudo apt-get install libeigen3-dev
默认安装路径为:
/usr/include/eigen3
安装版本查询命令:
pkg-config --modversion eigen3
2、CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(hello_world)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
/usr/local/include
/usr/include/
/usr/include/eigen3
)
set(CMAKE_BUILD_TYPE "Debug") # 默认是Release模式,设置为Debug才能调试
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) # 设置可执行文件的输出目录
add_executable(hello_world test_eigen.cpp)
3、c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/eigen3"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
4、示例程序
#include <iostream>
#include <eigen3/Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXi m(2, 2);
m << 1, 2, 3, 4;
cout << m << endl;
return 0;
}
输出结果如下:
5、参考资料
[1] https://blog.csdn.net/weixin_45867382/article/details/122607631
【版权声明】
本文为博主原创文章,未经博主允许严禁转载,我们会定期进行侵权检索。
更多python技巧、三维算法、算法总结、大模型请关注我的博客:https://blog.csdn.net/suiyingy,或”乐乐感知学堂“公众号。Python三维领域专业书籍推荐:《人工智能点云处理及深度学习算法》。