一、使用平台
原本视觉SLAM十四讲中的代码是基于Ubuntu系统下进行编写的,现在将其转换到Windows下进行运行。
使用平台是visual studio 2022。
二、问题解决
(一)问题一
1. 问题描述
下面是源代码
Eigen::AngleAxisd rotation_vector ( M_PI/4, Eigen::Vector3d ( 0,0,1 ) );
在不做任何更改的前提下,会报出如下的错误。
发现未识别出来M_PI是什么。
2. 问题解决
需要将主函数前改变为如下
#include <iostream> #define _USE_MATH_DEFINES //#include <cmath> #include <math.h> #include <Eigen/Core> // 几何模型 #include <Eigen/Geometry> using namespace std;
其中,主要工作是添加入#define _USE_MATH_DEFINES这句。
具体原因请参考下篇博客