描述:从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.如不能消除 如何忽略这个警告?
[已解决] cc1.exe: some warnings being treated as errors
[已解决] cc1.exe: some warnings being treated as errors
- Attachments
-
- 警告截图
- miss.jpg (12.38 KiB) Viewed 6575 times
-
- 结构体截图
- 结构体.jpg (41.68 KiB) Viewed 6575 times
-
- 结构体数组截图
- 结构体数组.png (62.01 KiB) Viewed 6575 times
-
- Posts: 786
- Joined: Wed Nov 14, 2018 8:45 am
Re: cc1.exe: some warnings being treated as errors
不知道你是如何管理 qrcode 的,如果这个是做成一个 component 的话,可以在这个下面的 CMakeLists.txt 上添加:
忽略这个 error
Code: Select all
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-missing-braces")
Re: cc1.exe: some warnings being treated as errors
对的 component添加库的 按你的方式已经成功忽略了警告,编译通过了。十分感谢你!!!!
Re: cc1.exe: some warnings being treated as errors
有一个疑问哈:这样忽略警告的方式 通过编译 算不算作弊呀 对程序的长期运行有影响吗
-
- Posts: 786
- Joined: Wed Nov 14, 2018 8:45 am
Re: cc1.exe: some warnings being treated as errors
这个和编译器行为有些关系,具体有没有影响,这个和应用场景有关,不能绝对保证。但一般如果你当前没问题的话,应该影响不大。
Re: cc1.exe: some warnings being treated as errors
好的好的 再次感谢您 预祝中秋快乐!!
Who is online
Users browsing this forum: Bing [Bot] and 106 guests