屏蔽Eigen大量警告
1.下载eigen3.4.0
2.
cd eigen-3.4.0
vi Eigen/src/Core/util/DisableStupidWarnings.h 修改成如下部分
#elif defined __GNUC__
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wint-in-bool-context"
#pragma GCC diagnostic ignored "-Wint-in-bool-context"
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
#pragma GCC diagnostic ignored "-Wdeprecated"
#pragma GCC diagnostic ignored "-Wconversion-null"
#pragma GCC diagnostic ignored "-Wattributes"
#pragma GCC diagnostic ignored "-Wreturn-type"
#pragma GCC diagnostic ignored "-Wunused-result"
#if (!defined(EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#pragma GCC diagnostic push
#endif
// g++ warns about local variables shadowing member functions, which is too strict
#pragma GCC diagnostic ignored "-Wshadow"
#if __GNUC__ == 4 && __GNUC_MINOR__ < 8
// Until g++-4.7 there are warnings when comparing unsigned int vs 0, even in templated functions:
#pragma GCC diagnostic ignored "-Wtype-limits"
#endif
#if __GNUC__>=6
#pragma GCC diagnostic ignored "-Wignored-attributes"
#endif
#if __GNUC__==7
// See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89325
#pragma GCC diagnostic ignored "-Wattributes"
#endif
3.mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../ -DINCLUDE_INSTALL_DIR=../include #设置isntall到eigen-3.4.0/include
make
make install
4.使用时在CMakeLists.txt中添加
INCLUDE_DIRECTORIES(
"/home/jiatonglee/modules/eigen-3.4.0/include"
)
屏蔽Eigen3.4.0警告配置教程
本文档详细介绍了如何在使用Eigen3.4.0时屏蔽大量编译警告,包括修改Eigen源文件、创建构建目录、配置CMake并安装,以及在CMakeLists.txt中添加相关路径。通过这些步骤,可以避免在开发过程中因Eigen库引发的警告干扰。
8311

被折叠的 条评论
为什么被折叠?



