conflicting declaration 'SdFat SD'
Arduino: 1.8.3 (Linux), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, 115200, 4M (3M SPIFFS)"
In file included from /root/Arduino/libraries/PCAP-master/src/PCAP.h:13:0,
from /root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino:19:
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/FS.h:133:11: error: 'File' is already declared in this scope
using fs::File;
^
In file included from /root/Arduino/libraries/PCAP-master/src/PCAP.h:14:0,
from /root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino:19:
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h:26:7: error: redefinition of 'class fs::File'
class File : public Stream {
^
In file included from /root/Arduino/libraries/PCAP-master/src/PCAP.h:13:0,
from /root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino:19:
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/FS.h:48:7: error: previous definition of 'class fs::File'
class File : public Stream
^
In file included from /root/Arduino/libraries/PCAP-master/src/PCAP.h:14:0,
Multiple libraries were found for "SD.h"
Used: /root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD
Not used: /root/Downloads/arduino-1.8.3-linux64/arduino-1.8.3/libraries/SD
from /root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino:19:
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h:82:3: error: 'SdVolume' does not name a type
SdVolume volume;
^
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h:90:33: error: 'SD_CHIP_SELECT_PIN' was not declared in this scope
boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN, uint32_t speed = SPI_HALF_SPEED);
^
In file included from /root/Arduino/libraries/SdFat-master/src/SdCard/SdSpiCard.h:28:0,
from /root/Arduino/libraries/SdFat-master/src/BlockDriver.h:27,
from /root/Arduino/libraries/SdFat-master/src/SdFat.h:27,
from /root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino:18:
/root/Arduino/libraries/SdFat-master/src/SdCard/SdInfo.h:98:70: error: could not convert 'SPISettings(20000000u, 1, 0)' from 'SPISettings' to 'uint32_t {aka unsigned int}'
#define SD_SCK_HZ(maxSpeed) SPISettings(maxSpeed, MSBFIRST, SPI_MODE0)
^
/root/Arduino/libraries/SdFat-master/src/SdCard/SdInfo.h:106:24: note: in expansion of macro 'SD_SCK_HZ'
#define SPI_HALF_SPEED SD_SCK_HZ(F_CPU/4)
^
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h:90:70: note: in expansion of macro 'SPI_HALF_SPEED'
boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN, uint32_t speed = SPI_HALF_SPEED);
^
In file included from /root/Arduino/libraries/PCAP-master/src/PCAP.h:14:0,
from /root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino:19:
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h: In member function 'uint8_t SDClass::fatType()':
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h:115:29: error: 'volume' was not declared in this scope
uint8_t fatType(){ return volume.fatType(); }
^
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h: In member function 'size_t SDClass::blocksPerCluster()':
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h:116:37: error: 'volume' was not declared in this scope
size_t blocksPerCluster(){ return volume.blocksPerCluster(); }
^
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h: In member function 'size_t SDClass::totalClusters()':
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h:117:34: error: 'volume' was not declared in this scope
size_t totalClusters(){ return volume.clusterCount(); }
^
/root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino: At global scope:
esp8266_pcap_sd:36: error: conflicting declaration 'SdFat SD'
SdFat SD;
^
In file included from /root/Arduino/libraries/PCAP-master/src/PCAP.h:14:0,
from /root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino:19:
/root/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/SD.h:135:16: error: 'SD' has a previous declaration as 'SDClass SD'
extern SDClass SD;
^
/root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino: In function 'void openFile()':
esp8266_pcap_sd:70: error: no matching function for call to 'PCAP::openFile(SDClass&)'
fileOpen = pcap.openFile(SD);
^
/root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino:70:30: note: candidate is:
In file included from /root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino:19:0:
/root/Arduino/libraries/PCAP-master/src/PCAP.h:28:7: note: bool PCAP::openFile(fs::FS&)
bool openFile(fs::FS &fs);
^
/root/Arduino/libraries/PCAP-master/src/PCAP.h:28:7: note: no known conversion for argument 1 from 'SDClass' to 'fs::FS&'
/root/Arduino/libraries/PCAP-master/examples/esp8266_pcap_sd/esp8266_pcap_sd.ino: In function 'void setup()':
esp8266_pcap_sd:89: error: call to 'boolean SDClass::begin(uint8_t, uint32_t)' uses the default argument for parameter 1, which is not yet defined
if(!SD.begin()) {
^
esp8266_pcap_sd:89: error: cannot convert 'SPISettings' to 'uint32_t {aka unsigned int}' for argument '2' to 'boolean SDClass::begin(uint8_t, uint32_t)'
exit status 1
conflicting declaration 'SdFat SD'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Sorry hadn't had time to look into it until now! I think I fixed it for now, try it again with the latest source.
I wasn't really able to get it running stable on my ESP8266 boards again. I think there are huge differences in terms of performance depending on your surrounding WiFi traffic and the ESP8266 chip/board you're using. So keep that in mind please :)
I can't seem to get this working on the ESP8266, I keep getting this error: "/Documents/Arduino/libraries/ArduinoPcap-master/src/PCAP.h:31:16: error: 'SdFat' has not been declared bool openFile(SdFat &SD); "
I think it has to do with the PCAP.H including SdFat in the If statements:
#ifndef PCAP_h
#define PCAP_h
#include <Arduino.h>
#include "SPI.h"
#if defined(ESP32)
#include "FS.h"
#include "SD.h"
#else
#include <SPI.h>
#include <SdFat.h>
#endif
Are these additional libraries we need to install ?
Try it with esp8266 community version 2.3.0 it worked for me ..
It only works with SdFat v2.0.1 since SdFat changed a lot and the project isn't maintained for 3 years. Considering it's an open-source project, someone might update the code to work with the latest SdFat library but, who that will be right?