Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1120|回复: 12

[未解决] 求助加载第三方库一调用就报错无法编译

[复制链接]
发表于 2022-8-19 13:22 | 显示全部楼层 |阅读模式
RT,有没有大佬知道这是什么情况

在百度上找了一上午也没有成果

QQ截图20220819130320.png
发表于 2022-8-19 14:47 | 显示全部楼层
把库初始化一下在编译!
发表于 2022-8-19 16:29 | 显示全部楼层
请问解决了吗   我也是遇到了同样的问题,怎么初始化库
发表于 2022-8-19 16:35 | 显示全部楼层
库有问题,你换个库就行了
发表于 2022-8-19 17:17 | 显示全部楼层
意思是i2c错误,库没有引用,管脚没有设置,实体没有开始。
库不能这样只写一句include的,IDE的报错告诉你:年轻人要讲武德!
发表于 2022-8-19 21:32 | 显示全部楼层
topdog 发表于 2022-8-19 17:17
意思是i2c错误,库没有引用,管脚没有设置,实体没有开始。
库不能这样只写一句include的,IDE的报错告诉你 ...

我这个错误是怎么回事,不知道哪里出问题了














D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp: In member function 'void Adafruit_SPIDevice::transfer(uint8_t*, size_t)':
D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp:133:31: error: no matching function for call to 'SPIClass::transfer(uint8_t*&, size_t&)'
     _spi->transfer(buffer, len);
                               ^
In file included from D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.h:9:0,
                 from D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp:1:
D:\Program Files (x86)\arduino1\hardware\espressif\esp32\libraries\SPI\src/SPI.h:67:13: note: candidate: uint8_t SPIClass::transfer(uint8_t)
     uint8_t transfer(uint8_t data);
             ^
D:\Program Files (x86)\arduino1\hardware\espressif\esp32\libraries\SPI\src/SPI.h:67:13: note:   candidate expects 1 argument, 2 provided
D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp: In member function 'bool Adafruit_SPIDevice::write(const uint8_t*, size_t, const uint8_t*, size_t)':
D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp:335:61: error: invalid conversion from 'const uint8_t* {aka const unsigned char*}' to 'uint8_t* {aka unsigned char*}' [-fpermissive]
       _spi->transferBytes(prefix_buffer, nullptr, prefix_len);
                                                             ^
In file included from D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.h:9:0,
                 from D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp:1:
D:\Program Files (x86)\arduino1\hardware\espressif\esp32\libraries\SPI\src/SPI.h:70:10: note:   initializing argument 1 of 'void SPIClass::transferBytes(uint8_t*, uint8_t*, uint32_t)'
     void transferBytes(uint8_t * data, uint8_t * out, uint32_t size);
          ^
D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp:338:47: error: invalid conversion from 'const uint8_t* {aka const unsigned char*}' to 'uint8_t* {aka unsigned char*}' [-fpermissive]
       _spi->transferBytes(buffer, nullptr, len);
                                               ^
In file included from D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.h:9:0,
                 from D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp:1:
D:\Program Files (x86)\arduino1\hardware\espressif\esp32\libraries\SPI\src/SPI.h:70:10: note:   initializing argument 1 of 'void SPIClass::transferBytes(uint8_t*, uint8_t*, uint32_t)'
     void transferBytes(uint8_t * data, uint8_t * out, uint32_t size);
          ^
D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp: In member function 'bool Adafruit_SPIDevice::write_then_read(const uint8_t*, size_t, uint8_t*, size_t, uint8_t)':
D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp:429:59: error: invalid conversion from 'const uint8_t* {aka const unsigned char*}' to 'uint8_t* {aka unsigned char*}' [-fpermissive]
       _spi->transferBytes(write_buffer, nullptr, write_len);
                                                           ^
In file included from D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.h:9:0,
                 from D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.cpp:1:
D:\Program Files (x86)\arduino1\hardware\espressif\esp32\libraries\SPI\src/SPI.h:70:10: note:   initializing argument 1 of 'void SPIClass::transferBytes(uint8_t*, uint8_t*, uint32_t)'
     void transferBytes(uint8_t * data, uint8_t * out, uint32_t size);
          ^
"WiFi.h" 对应多个库
已使用: D:\Program Files (x86)\arduino1\hardware\espressif\esp32\libraries\WiFi
未使用:D:\Program Files (x86)\arduino\libraries\WiFi
exit status 1
为开发板 ESP32F 编译时出错。
发表于 2022-8-19 22:56 | 显示全部楼层
提示这两个库spi赋值要求。
D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevice.h
D:\Program Files (x86)\arduino1\hardware\espressif\esp32\libraries\SPI\src/SPI.h
"WiFi.h" 对应多个库,把后面一个删了。
已使用: D:\Program Files (x86)\arduino1\hardware\espressif\esp32\libraries\WiFi
未使用:D:\Program Files (x86)\arduino\libraries\WiFi
发表于 2022-8-20 00:05 | 显示全部楼层
topdog 发表于 2022-8-19 22:56
提示这两个库spi赋值要求。
D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevic ...

不知道怎么搞赋值,我可以把这几个ino文件发给你,麻烦你给我跑出来对应的bin文件可以吗?感谢。QQ:1491001066
发表于 2022-8-20 00:35 | 显示全部楼层
topdog 发表于 2022-8-19 22:56
提示这两个库spi赋值要求。
D:\Program Files (x86)\arduino1\libraries\Adafruit_BusIO\Adafruit_SPIDevic ...

你好,哥哥,麻烦有空的话可以给我那几个ino 文件编译一下吗,编译成bin文件就行,感谢
发表于 2022-8-20 11:26 | 显示全部楼层
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|Arduino中文社区

GMT+8, 2022-10-7 20:34 , Processed in 0.030483 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表