编译srs-bench,出现http_parser.c:2093:18: error: this statement may fall through [-Werror=implicit-fallth

http_parser.c:2093:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
         found_at = 1;
         ~~~~~~~~~^~~

原因如下

http-parser的编译同时打开了-Wall -Wextra -Werror

-Wimplicit-fallthrough,是C++17标准引入的警告选项,因为这个地方没有break。如果编译时有编译选项-Wextra,该编译选项将添加。-Werror将警告视为错误报出。

解决方案

vim objs/http-parser-2.1/Makefile

 把其中的

CFLAGS += -Wall -Wextra -Werror 

改为

CFLAGS += -Wall -Wextra

再把config文件中的解压的那两行改为

#rm -rf ${GLOBAL_DIR_OBJS}/http-parser-2.1 && cd ${GLOBAL_DIR_OBJS} && unzip ../3rdparty/http-parser-2.1.zip &&
cd objs/http-parser-2.1 &&

再重新./configure就OK啦

 

你可能感兴趣的:(srs)