`uint32_t' undeclared here (not in a function)

在Linux系统上遇到四字符编码类问题时,通过加入特定的头文件即可解决。本文详细介绍了如何在代码中引入<stdint.h>来避免相关错误。


//399 E:\codeReocrdi\test_fourcc_lookfor_class_dspt.c `uint32_t' undeclared here (not in a function)  

在linux系统上,加入

#include<stdint.h>

就好了。


WARNING: library USBHost claims to run on sam architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s). In file included from c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/KeyboardController.h:22, from D:\kaifa\printer\HP2124\HP2124.ino:1: c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h: In member function 'virtual void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint32_t, uint32_t, uint32_t, uint32_t, const USB_ENDPOINT_DESCRIPTOR*)': c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:474:76: error: 'UOTGHS_HSTPIPCFG_PTYPE_INTRPT' was not declared in this scope 474 | pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:474:107: error: 'UOTGHS_HSTPIPCFG_PTOKEN_IN' was not declared in this scope 474 | pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:474:165: error: 'UOTGHS_HSTPIPCFG_PBK_1_BANK' was not declared in this scope 474 | pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:474:24: error: there are no arguments to 'UHD_Pipe_Alloc' that depend on a template parameter, so a declaration of 'UHD_Pipe_Alloc' must be available [-fpermissive] 474 | pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK); | ^~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:474:24: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h: In member function 'virtual uint32_t HIDBoot<BOOT_PROTOCOL>::Release()': c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:500:9: error: there are no arguments to 'UHD_Pipe_Free' that depend on a template parameter, so a declaration of 'UHD_Pipe_Free' must be available [-fpermissive] 500 | UHD_Pipe_Free(epInfo[epInterruptInIndex].hostPipeNum); | ^~~~~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino: At global scope: D:\kaifa\printer\HP2124\HP2124.ino:22:1: error: 'USBPrinter' does not name a type 22 | USBPrinter printer; // USB打印机实例 | ^~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:32:6: error: variable or field 'printerEventCallback' declared void 32 | void printerEventCallback(usb_host_client_handle_t clientHandle, | ^~~~~~~~~~~~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:32:27: error: 'usb_host_client_handle_t' was not declared in this scope 32 | void printerEventCallback(usb_host_client_handle_t clientHandle, | ^~~~~~~~~~~~~~~~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:32:66: error: 'usb_host_event_t' was not declared in this scope 32 | void printerEventCallback(usb_host_client_handle_t clientHandle, | ^ D:\kaifa\printer\HP2124\HP2124.ino:32:90: error: expected primary-expression before 'void' 32 | void printerEventCallback(usb_host_client_handle_t clientHandle, | ^ D:\kaifa\printer\HP2124\HP2124.ino:32:6: error: variable or field 'printerEventCallback' declared void 32 | void printerEventCallback(usb_host_client_handle_t clientHandle, | ^~~~~~~~~~~~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:32:27: error: 'usb_host_client_handle_t' was not declared in this scope 32 | void printerEventCallback(usb_host_client_handle_t clientHandle, | ^~~~~~~~~~~~~~~~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:33:26: error: 'usb_host_event_t' was not declared in this scope 33 | usb_host_event_t event, void *arg) { | ^~~~~~~~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:33:50: error: expected primary-expression before 'void' 33 | usb_host_event_t event, void *arg) { | ^~~~ D:\kaifa\printer\HP2124\HP2124.ino: In function 'void sendPCLCommand(const uint8_t*, size_t)': D:\kaifa\printer\HP2124\HP2124.ino:68:27: error: no matching function for call to 'min(int, size_t)' 68 | size_t chunkSize = min(64, len - i); | ~~~^~~~~~~~~~~~~ In file included from C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/algorithm:61, from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.0\cores\esp32/Arduino.h:190, from c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hid.h:24, from c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:24: C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algo.h:5695:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5695 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algo.h:5695:5: note: template argument deduction/substitution failed: D:\kaifa\printer\HP2124\HP2124.ino:68:27: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 68 | size_t chunkSize = min(64, len - i); | ~~~^~~~~~~~~~~~~ C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algo.h:5685:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5685 | min(initializer_list<_Tp> __l) | ^~~ C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algo.h:5685:5: note: candidate expects 1 argument, 2 provided In file included from C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/specfun.h:43, from C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/cmath:3898, from C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/math.h:36, from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.0\cores\esp32/esp32-hal.h:30, from C:\Users\Dev\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.0\cores\esp32/Arduino.h:44: C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ C:/Users/Dev/AppData/Local/Arduino15/packages/esp32/tools/esp-x32/2411/xtensa-esp-elf/include/c++/14.2.0/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: D:\kaifa\printer\HP2124\HP2124.ino:68:27: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'size_t' {aka 'unsigned int'}) 68 | size_t chunkSize = min(64, len - i); | ~~~^~~~~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:69:10: error: 'printer' was not declared in this scope; did you mean 'printf'? 69 | if (!printer.sendData(data + i, chunkSize)) { | ^~~~~~~ | printf D:\kaifa\printer\HP2124\HP2124.ino: In function 'void setup()': D:\kaifa\printer\HP2124\HP2124.ino:96:16: error: 'class USBHost' has no member named 'begin' 96 | if (!usbHost.begin()) { | ^~~~~ D:\kaifa\printer\HP2124\HP2124.ino:102:3: error: 'printer' was not declared in this scope; did you mean 'printf'? 102 | printer.registerEventCallback(printerEventCallback); | ^~~~~~~ | printf D:\kaifa\printer\HP2124\HP2124.ino:102:33: error: 'printerEventCallback' was not declared in this scope 102 | printer.registerEventCallback(printerEventCallback); | ^~~~~~~~~~~~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:105:3: error: 'USBHConfig' was not declared in this scope 105 | USBHConfig config = { | ^~~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:109:11: error: 'class USBHost' has no member named 'setConfig'; did you mean 'USBDeviceConfig* USBHost::devConfig [16]'? (not accessible from this context) 109 | usbHost.setConfig(config); | ^~~~~~~~~ In file included from c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:23: c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/Usb.h:163:65: note: declared private here 163 | USBDeviceConfig* devConfig[USB_NUMDEVICES]; | ^~~~~~~~~ D:\kaifa\printer\HP2124\HP2124.ino:109:21: error: 'config' was not declared in this scope 109 | usbHost.setConfig(config); | ^~~~~~ D:\kaifa\printer\HP2124\HP2124.ino: In function 'void loop()': D:\kaifa\printer\HP2124\HP2124.ino:115:11: error: 'class USBHost' has no member named 'task'; did you mean 'Task'? 115 | usbHost.task(); // 处理USB事件 | ^~~~ | Task c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h: In instantiation of 'uint32_t HIDBoot<BOOT_PROTOCOL>::Release() [with unsigned char BOOT_PROTOCOL = 2; uint32_t = long unsigned int]': c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:497:10: required from here 497 | uint32_t HIDBoot<BOOT_PROTOCOL>::Release() | ^~~~~~~~~~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:500:22: error: 'UHD_Pipe_Free' was not declared in this scope 500 | UHD_Pipe_Free(epInfo[epInterruptInIndex].hostPipeNum); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h: In instantiation of 'void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint32_t, uint32_t, uint32_t, uint32_t, const USB_ENDPOINT_DESCRIPTOR*) [with unsigned char BOOT_PROTOCOL = 2; uint32_t = long unsigned int]': c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:447:6: required from here 447 | void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint32_t conf, uint32_t iface, uint32_t alt, uint32_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) | ^~~~~~~~~~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:474:192: error: 'UHD_Pipe_Alloc' was not declared in this scope 474 | pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK); | ^ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h: In instantiation of 'uint32_t HIDBoot<BOOT_PROTOCOL>::Release() [with unsigned char BOOT_PROTOCOL = 1; uint32_t = long unsigned int]': c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:497:10: required from here 497 | uint32_t HIDBoot<BOOT_PROTOCOL>::Release() | ^~~~~~~~~~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:500:22: error: 'UHD_Pipe_Free' was not declared in this scope 500 | UHD_Pipe_Free(epInfo[epInterruptInIndex].hostPipeNum); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h: In instantiation of 'void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint32_t, uint32_t, uint32_t, uint32_t, const USB_ENDPOINT_DESCRIPTOR*) [with unsigned char BOOT_PROTOCOL = 1; uint32_t = long unsigned int]': c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:447:6: required from here 447 | void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint32_t conf, uint32_t iface, uint32_t alt, uint32_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) | ^~~~~~~~~~~~~~~~~~~~~~ c:\Users\Dev\Documents\Arduino\libraries\USBHost\src/hidboot.h:474:192: error: 'UHD_Pipe_Alloc' was not declared in this scope 474 | pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK); | ^ exit status 1 Compilation error: 'USBPrinter' does not name a type
08-14
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

等风来不如迎风去

你的鼓励是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值