error: 'LOGE' was not declared in this scope

移植了下HAL,发现编译出现如下错误

error: 'LOGE' was not declared in this scope

比较了一下android4.1的 system/core/include/cutils/log.h和android4.0的对应文件,

发现在4.1当中已经将所有的LOG宏前面加了一个字母A 。所以出现上述编译错误。

修改HAL层源码:将LOGE   LOGD等等全部加个A

方法:


sed  -i  "s/LOG/ALOG/g"  `grep  LOG  -rl  .`




附上一个linux中的字符串查找替换用法:

Linux 下各种查找替换字符串的办法  

2009-03-12 10:54:13|  分类: Linux |字号 订阅
1、在vi中使用的查找替换方法 
利用 :s 命令可以实现字符串的替换。具体的用法包括: 
:s/str1/str2/ 用字符串 str2 替换行中首次出现的字符串 str1 
:s/str1/str2/g 用字符串 str2 替换行中所有出现的字符串 str1 
:.,$ s/str1/str2/g 用字符串 str2 替换正文当前行到末尾所有出现的字符串 str1 
:1,$ s/str1/str2/g 用字符串 str2 替换正文中所有出现的字符串 str1 
:g/str1/s//str2/g 功能同上从上述替换命令可以看到:g 放在命令末尾,表示对搜索字符串的每次出现进行替换;不加 g,表示只对搜索字符串的首次出现进行替换;g 放在命令开头,表示对正文中所有包含搜索字符串的行进行替换操作。

2、在shell中使用find结合grep进行文件的替换 
# find ./ -exec grep str1 ‘{}’ \; -exec sed -i.bak s/str1/str2/g ‘{}’ \; 
上面命令可以在当前目录下(包括子目录)查找包含str1的文件,自动替换成str2,并且生成源文件的bak文件 


3、sed Linux下批量替换多个文件中的字符串的简单方法


用sed命令可以批量替换多个文件中的字符串。 
用sed命令可以批量替换多个文件中的字符串。
sed -i "s/原字符串/新字符串/g" `grep 原字符串 -rl 所在目录`
例如:我要把aaa替换为bbb,执行命令:
sed -i "s/aaa/bbb/g" 'grep aaa -rl /www'
这是目前linux最简单的批量替换字符串命令了!


具体格式如下: 
sed -i "s/oldString/newString/g" `grep oldString -rl /path`
实例代码:sed -i "s/123/456/g" `grep 123 -rl /usr/aa`
sed -i "s/123/456/g" `grep 123 -rl ./`

千万注意:gerp前面的符号是Tab键上方的那个 `  ,而不是单引号!

D:\kaifa\printer\HP12S\HP12S.ino: In function 'void enhanced_printer_reset(usb_device_handle_t)': D:\kaifa\printer\HP12S\HP12S.ino:38:9: error: 'usb_host_device_bulk_transfer' was not declared in this scope; did you mean 'usb_host_device_close'? 38 | usb_host_device_bulk_transfer(dev_handle, 0x01, (uint8_t*)reset_cmd, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | usb_host_device_close D:\kaifa\printer\HP12S\HP12S.ino:42:5: error: 'usb_host_device_bulk_transfer' was not declared in this scope; did you mean 'usb_host_device_close'? 42 | usb_host_device_bulk_transfer(dev_handle, 0x01, (uint8_t*)hp_init, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | usb_host_device_close D:\kaifa\printer\HP12S\HP12S.ino: In function 'hp_status_t check_printer_status(usb_device_handle_t)': D:\kaifa\printer\HP12S\HP12S.ino:53:5: error: 'usb_host_device_bulk_transfer' was not declared in this scope; did you mean 'usb_host_device_close'? 53 | usb_host_device_bulk_transfer(dev_handle, 0x01, (uint8_t*)status_cmd, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | usb_host_device_close In file included from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/esp_hw_support/include/esp_intr_alloc.h:12, from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/esp_hw_support/include/esp_cpu.h:21, from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/esp_hw_support/include/spinlock.h:11, from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:49, from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/freertos/FreeRTOS-Kernel/include/freertos/portable.h:57, from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/freertos/FreeRTOS-Kernel/include/freertos/FreeRTOS.h:69, from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\cores\esp32/Arduino.h:33, from C:\Users\Dev\AppData\Local\arduino\sketches\8837627847CF4F29BE8290B48252B2FB\sketch\HP12S.ino.cpp:1: D:\kaifa\printer\HP12S\HP12S.ino: In function 'void app_main()': D:\kaifa\printer\HP12S\HP12S.ino:81:21: error: 'usb_host_get_device_list' was not declared in this scope; did you mean 'usb_host_device_close'? 81 | ESP_ERROR_CHECK(usb_host_get_device_list(&dev_list, &num_devices)); | ^~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/esp_common/include/esp_err.h:116:30: note: in definition of macro 'ESP_ERROR_CHECK' 116 | esp_err_t err_rc_ = (x); \ | ^ D:\kaifa\printer\HP12S\HP12S.ino:86:66: error: cannot convert 'usb_device_info_t' to 'usb_device_handle_t' {aka 'usb_device_handle_s*'} 86 | ESP_ERROR_CHECK(usb_host_get_device_descriptor(dev_list[i], &dev_desc)); | ~~~~~~~~~~^ | | | usb_device_info_t C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/esp_common/include/esp_err.h:116:30: note: in definition of macro 'ESP_ERROR_CHECK' 116 | esp_err_t err_rc_ = (x); \ | ^ In file included from D:\kaifa\printer\HP12S\HP12S.ino:2: C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.5-07e9bf49-v1\esp32s3/include/usb/include/usb/usb_host.h:422:62: note: initializing argument 1 of 'esp_err_t usb_host_get_device_descriptor(usb_device_handle_t, const usb_device_desc_t**)' 422 | esp_err_t usb_host_get_device_descriptor(usb_device_handle_t dev_hdl, const usb_device_desc_t **device_desc); | ~~~~~~~~~~~~~~~~~~~~^~~~~~~ D:\kaifa\printer\HP12S\HP12S.ino:89:40: error: cannot convert 'usb_device_info_t' to 'usb_device_handle_t' {aka 'usb_device_handle_s*'} in assignment 89 | printer_handle = dev_list[i]; | ~~~~~~~~~~^ | | | usb_device_info_t D:\kaifa\printer\HP12S\HP12S.ino:126:5: error: 'usb_host_free_device_list' was not declared in this scope; did you mean 'usb_host_device_close'? 126 | usb_host_free_device_list(dev_list); | ^~~~~~~~~~~~~~~~~~~~~~~~~ | usb_host_device_close exit status 1 Compilation error: 'usb_host_device_bulk_transfer' was not declared in this scope; did you mean 'usb_host_device_close'?
最新发布
10-18
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YasinLeeX

再来一杯西湖龙井。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值