Ubuntu下解决Make的:cc1plus: warnings being treated as errors

本文介绍了解决Make过程中遇到的cc1plus警告被视为错误的问题。主要是由于Makefile中gcc参数包含了-Werror导致,解决方法为移除该参数并重新编译。

From: http://blog.sina.com.cn/s/blog_a5cf7b9a01011kzt.html


当Make出错,提示cc1plus: warnings being treated as errors,主要原因是 Makefile 里面 gcc 的参数多了一个"-Werror",找到出错的make文件夹,看Make文件里面有没有“-Werror",如果有的话将其删除。重新编译即可。

Livox-SDK make失败 git clone https://github.com/Livox-SDK/Livox-SDK.git cd Livox-SDK cd build cmake .. make sudo make install 按着这个指令去配置Livox-SDK,但是出现了以下报错 [ 2%] Building CXX object sdk_core/CMakeFiles/livox_sdk_static.dir/src/base/thread_base.cpp.o In file included from /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.cpp:25: /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.h:46:8: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type 46 | std::shared_ptr<std::thread> thread_; | ^~~~~~~~~~ /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.h:30:1: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’? 29 | #include "noncopyable.h" +++ |+#include <memory> 30 | /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.cpp: In member function ‘virtual bool livox::ThreadBase::Start()’: /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.cpp:34:3: error: ‘thread_’ was not declared in this scope; did you mean ‘pthread_t’? 34 | thread_ = std::make_shared<std::thread>(&ThreadBase::ThreadFunc, this); | ^~~~~~~ | pthread_t /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.cpp:34:18: error:make_shared’ is not a member of ‘std’ 34 | thread_ = std::make_shared<std::thread>(&ThreadBase::ThreadFunc, this); | ^~~~~~~~~~~ /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.cpp:26:1: note: ‘std::make_shared’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’? 25 | #include "thread_base.h" +++ |+#include <memory> 26 | #include <thread> /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.cpp:34:41: error: expected primary-expression before ‘>’ token 34 | thread_ = std::make_shared<std::thread>(&ThreadBase::ThreadFunc, this); | ^ /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.cpp:34:68: error: left operand of comma operator has no effect [-Werror=unused-value] 34 | thread_ = std::make_shared<std::thread>(&ThreadBase::ThreadFunc, this); | ^~~~ /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.cpp: In member function ‘virtual void livox::ThreadBase::Join()’: /home/lkw/Livox-SDK/sdk_core/src/base/thread_base.cpp:41:5: error: ‘thread_’ was not declared in this scope; did you mean ‘pthread_t’? 41 | thread_->join(); | ^~~~~~~ | pthread_t At global scope: cc1plus: note: unrecognized command-line option ‘-Wno-c++11-long-long’ may have been intended to silence earlier diagnostics cc1plus: all warnings being treated as errors make[2]: *** [sdk_core/CMakeFiles/livox_sdk_static.dir/build.make:104:sdk_core/CMakeFiles/livox_sdk_static.dir/src/base/thread_base.cpp.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:242:sdk_core/CMakeFiles/livox_sdk_static.dir/all] 错误 2 make: *** [Makefile:136:all] 错误 2
最新发布
12-12
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值