warning: backslash and newline separated by space

本文探讨了一段代码中出现警告提示的原因及解决方法,通过移除特定字符避免警告出现,提供了解决代码问题的有效策略。

在写下面代码时候出现警告提示:

	char m_SPS[256] =   {   0x67, 0x64, 0x00, 0x28, 0xAD, 0x84, 0x05, 0x45, 0x62, 0xB8, 0xAC, 0x54, 0x74, 0x20, 0x2A, 0x2B,	\
 						0x15, 0xC5, 0x62, 0xA3, 0xA1, 0x01, 0x51, 0x58, 0xAE, 0x2B, 0x15, 0x1D, 0x08, 0x0A, 0x8A, 0xC5,	\
 						0x71, 0x58, 0xA8, 0xE8, 0x40, 0x54, 0x56, 0x2B, 0x8A, 0xC5, 0x47, 0x42, 0x02, 0xA2, 0xB1, 0x5C,	\
 						0x56, 0x2A, 0x3A, 0x10, 0x24, 0x85, 0x21, 0x39, 0x3C, 0x9F, 0x27, 0xE4, 0xFE, 0x4F, 0xC9, 0xF2, 	\
 						0x79, 0xB9, 0xB3, 0x4D, 0x08, 0x12, 0x42, 0x90, 0x9C, 0x9E, 0x4F, 0x93, 0xF2, 0x7F, 0x27, 0xE4,	\
 						0xF9, 0x3C, 0xDC, 0xD9, 0xA6, 0xB4 ,0x05, 0x01, 0xED, 0x2A, 0x40, 0x00, 0x04, 0xE2, 0x00, 0x00,	\
						0x57, 0xE4, 0x18, 0x10, 0x00, 0x72, 0x40, 0x00, 0x06, 0x06, 0x7A, 0xF7, 0xBE, 0x17, 0x84, 0x42,	\
 						0x35};

原因是警告的对应行的“\”后面有空格,去掉就OK了。
改为GCC11,然后cmakelists文件也修改了,但是还是报错:In file included from /home/guo/定位新代码/src/share/common/include/base/file.h:15, from /home/guo/定位新代码/src/share/common/include/base/file.cpp:1: /home/guo/定位新代码/src/share/common/include/base/macros.h:29:62: warning: backslash and newline separated by space 29 | expression; \ | In file included from /home/guo/定位新代码/src/share/common/include/base/file.h:15, from /home/guo/定位新代码/src/share/common/include/base/format.h:13, from /home/guo/定位新代码/src/share/common/include/base/format.cpp:1: /home/guo/定位新代码/src/share/common/include/base/macros.h:29:62: warning: backslash and newline separated by space 29 | expression; \ | [ 96%] Linking CXX shared library /home/guo/定位新代码/devel/lib/libabsl_log_flags.so [ 96%] Built target log_flags In file included from /home/guo/定位新代码/src/share/common/include/base/health_reporter.h:13, from /home/guo/定位新代码/src/share/common/include/base/health_reporter.cpp:1: /home/guo/定位新代码/src/share/common/include/base/macros.h:29:62: warning: backslash and newline separated by space 29 | expression; \ | [ 96%] Linking CXX shared library /home/guo/定位新代码/devel/lib/libabsl_flags_usage_internal.so In file included from /home/guo/定位新代码/src/share/common/include/base/health_reporter.h:15, from /home/guo/定位新代码/src/share/common/include/base/health_reporter.cpp:1: /home/guo/定位新代码/src/share/common/include/base/traits.h:3:10: fatal error: concepts: 没有那个文件或目录 3 | #include <concepts> | ^~~~~~~~~~ compilation terminated. make[2]: *** [share/common/include/base/CMakeFiles/common_base.dir/build.make:104:share/common/include/base/CMakeFiles/common_base.dir/health_reporter.cpp.o] 错误 1 make[2]: *** 正在等待未完成的任务.... [ 96%] Built target flags_usage_internal Consolidate compiler generated dependencies of target flags_usage [ 97%] Building CXX object share/common/include/abseil-cpp/absl/flags/CMakeFiles/flags_usage.dir/usage.cc.o In file included from /home/guo/定位新代码/src/share/common/include/base/node_base.h:17, from /home/guo/定位新代码/src/share/common/include/base/node_base.cpp:1: /home/guo/定位新代码/src/share/common/include/base/macros.h:29:62: warning: backslash and newline separated by space 29 | expression; \ | In file included from /home/guo/定位新代码/src/share/common/include/base/node_base.h:19, from /home/guo/定位新代码/src/share/common/include/base/node_base.cpp:1: /home/guo/定位新代码/src/share/common/include/base/traits.h:3:10: fatal error: concepts: 没有那个文件或目录 3 | #include <concepts>
10-15
config/pallet_detect_class.h:23, from /home/workspace/hangcha_visual_program/visual/src/Auto/pallet_detect.cc:12: /home/workspace/hangcha_visual_program/visual/include/config/lsingleton.h:40:34: warning: backslash and newline separated by space 40 | #define GET_LSingObj(class_name) \ | /home/workspace/hangcha_visual_program/visual/include/config/lsingleton.h:42:38: warning: backslash and newline separated by space 42 | #define DESTROY_LSingObj(class_name) \ | /home/workspace/hangcha_visual_program/visual/src/Auto/pallet_detect.cc:17:6: error: no declaration matches 'bool Visual::PalletDetect::InitPalletDetectParam(std::string)' 17 | bool PalletDetect::InitPalletDetectParam(std::string yaml_dir){ | ^~~~~~~~~~~~ In file included from /home/workspace/hangcha_visual_program/visual/src/Auto/pallet_detect.cc:12: /home/workspace/hangcha_visual_program/visual/include/config/pallet_detect_class.h:36:14: note: candidate is: 'template<class PointT> bool Visual::PalletDetect::InitPalletDetectParam(std::string)' 36 | bool InitPalletDetectParam(std::string yaml_dir); | ^~~~~~~~~~~~~~~~~~~~~ /home/workspace/hangcha_visual_program/visual/include/config/pallet_detect_class.h:30:11: note: 'class Visual::PalletDetect' defined here 30 | class PalletDetect{ | ^~~~~~~~~~~~ /home/workspace/hangcha_visual_program/visual/src/Auto/pallet_detect.cc: In member function 'void Visual::PalletDetect::PassThrough(const pcl::PointCloud<pcl::PointXYZ>&, pcl::PointCloud<pcl::PointXYZ>&, std::string&, float&, float&, bool)': /home/workspace/hangcha_visual_program/visual/src/Auto/pallet_detect.cc:375:48: warning: 'void pcl::PassThrough<PointT>::setFilterLimitsNegative(bool) [with PointT = pcl::PointXYZ]' is deprecated: use inherited FilterIndices::setNegative() instead (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 375 | pass.setFilterLimitsNegative(limit_negative); | ^ In file included from /home/workspace/hangcha_visual_program/visual/include/visual/pcl_common.h:19, from /home/workspace/hangcha_visual_program/visual/include/config/pallet_detect_class.h:14, from /home/workspace/hangcha_visual_program/visual/src/Auto/pallet_detect.cc:12: /home/workspace/hangcha_visual_program/library/pcl1_12/include/pcl-1.12/pcl/filters/passthrough.h:156:7: note: declared here 156 | setFilterLimitsNegative (const bool limit_negative) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/workspace/hangcha_visual_program/visual/src/Auto/pallet_detect.cc: In member function 'bool Visual::PalletDetect::GetClusters(const pcl::PointCloud<pcl::PointXYZ>&, const std::vector<pcl::PointIndices>&, std::vector<clusterOBBICP>&)': /home/workspace/hangcha_visual_program/visual/src/Auto/pallet_detect.cc:687:1: warning: no return statement in function returning non-void [-Wreturn-type] 687 | } | ^ make[2]: *** [CMakeFiles/visual.dir/build.make:271: CMakeFiles/visual.dir/src/Auto/pallet_detect.cc.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/visual.dir/all] Error 2 make: *** [Makefile:130: all] Error 2
最新发布
11-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值