Page 1 of 1

[已解决] cc1.exe: some warnings being treated as errors

Posted: Mon Sep 13, 2021 11:01 am
by Yobooy_
描述:从STM32移植QRCODE库到ESP32,编译报错:警告被当做错误处理。
环境:1.windows7,编译器是eclipse (QRCODE库在KEIL上编译和运行没问题);
2.SDK是esp-idf-v4.3(无分支);
3.硬件ESP32-WROVER-IE。
补充说明:报错处是个 带嵌套的一维结构体数组,(error: missing braces around initializer [-Werror=missing-braces])详见下图。
请教:1.能否消除这个警告? 2.如不能消除 如何忽略这个警告?

Re: cc1.exe: some warnings being treated as errors

Posted: Thu Sep 16, 2021 9:33 am
by ESP_Gargamel
不知道你是如何管理 qrcode 的,如果这个是做成一个 component 的话,可以在这个下面的 CMakeLists.txt 上添加:

Code: Select all

target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-missing-braces")
忽略这个 error

Re: cc1.exe: some warnings being treated as errors

Posted: Thu Sep 16, 2021 11:08 am
by Yobooy_
对的 component添加库的 按你的方式已经成功忽略了警告,编译通过了。十分感谢你!!!!

Re: cc1.exe: some warnings being treated as errors

Posted: Thu Sep 16, 2021 11:10 am
by Yobooy_
有一个疑问哈:这样忽略警告的方式 通过编译 算不算作弊呀 对程序的长期运行有影响吗

Re: cc1.exe: some warnings being treated as errors

Posted: Fri Sep 17, 2021 3:00 am
by ESP_Gargamel
这个和编译器行为有些关系,具体有没有影响,这个和应用场景有关,不能绝对保证。但一般如果你当前没问题的话,应该影响不大。

Re: cc1.exe: some warnings being treated as errors

Posted: Fri Sep 17, 2021 11:01 am
by Yobooy_
好的好的 再次感谢您 预祝中秋快乐!!