Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

'Sd2Card' does not name a type

Open
#48 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
embedded-iot

Research direction

Start with the Card Info sketch, specifically card_check.ino, and reproduce the compilation on the listed WeMos D1 R1 and ESP8266 2.5.2 setup. Compare the sketch's Sd2Card, SdVolume, SdFile, and listing constants with the included ESP8266SdFat headers. Done means the example compiles successfully and its SD-card information and directory listing work.

Written by the indexing model from the issue text.

Description

Hi
I am trying to compile the Card Info sketch and I get the following errors:

Arduino: 1.8.10 (Windows 7), Board: "WeMos D1 R1, 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

card_check:24:1: error: 'Sd2Card' does not name a type

Sd2Card card;

^

card_check:25:1: error: 'SdVolume' does not name a type

SdVolume volume;

^

card_check:26:1: error: 'SdFile' does not name a type

SdFile root;

^

C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino: In function 'void setup()':

card_check:45:8: error: 'card' was not declared in this scope

if (!card.init(SPI_HALF_SPEED, chipSelect)) {

    ^

card_check:57:11: error: 'card' was not declared in this scope

switch (card.type()) {

       ^

card_check:58:10: error: 'SD_CARD_TYPE_SD1' was not declared in this scope

 case SD_CARD_TYPE_SD1:

      ^

C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:58:10: note: suggested alternative:

In file included from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdCard/SdSpiCard.h:33:0,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/BlockDriver.h:32,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdFat.h:32,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SDFS\src/SDFS.h:36,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SD\src/SD.h:25,

             from C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:21:

C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdCard/SdInfo.h:101:15: note: 'sdfat::SD_CARD_TYPE_SD1'

const uint8_t SD_CARD_TYPE_SD1 = 1;

           ^

card_check:61:10: error: 'SD_CARD_TYPE_SD2' was not declared in this scope

 case SD_CARD_TYPE_SD2:

      ^

C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:61:10: note: suggested alternative:

In file included from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdCard/SdSpiCard.h:33:0,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/BlockDriver.h:32,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdFat.h:32,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SDFS\src/SDFS.h:36,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SD\src/SD.h:25,

             from C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:21:

C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdCard/SdInfo.h:103:15: note: 'sdfat::SD_CARD_TYPE_SD2'

const uint8_t SD_CARD_TYPE_SD2 = 2;

           ^

card_check:64:10: error: 'SD_CARD_TYPE_SDHC' was not declared in this scope

 case SD_CARD_TYPE_SDHC:

      ^

C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:64:10: note: suggested alternative:

In file included from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdCard/SdSpiCard.h:33:0,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/BlockDriver.h:32,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdFat.h:32,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SDFS\src/SDFS.h:36,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SD\src/SD.h:25,

             from C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:21:

C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdCard/SdInfo.h:105:15: note: 'sdfat::SD_CARD_TYPE_SDHC'

const uint8_t SD_CARD_TYPE_SDHC = 3;

           ^

card_check:72:8: error: 'volume' was not declared in this scope

if (!volume.init(card)) {

    ^

card_check:72:20: error: 'card' was not declared in this scope

if (!volume.init(card)) {

                ^

card_check:80:18: error: 'volume' was not declared in this scope

Serial.println(volume.fatType(), DEC);

              ^

card_check:96:3: error: 'root' was not declared in this scope

root.openRoot(volume);

^

card_check:99:11: error: 'LS_R' was not declared in this scope

root.ls(LS_R | LS_DATE | LS_SIZE);

       ^

C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:99:11: note: suggested alternative:

In file included from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/FatFile.h:36:0,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/ArduinoFiles.h:33,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/FatLib.h:27,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdFat.h:33,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SDFS\src/SDFS.h:36,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SD\src/SD.h:25,

             from C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:21:

C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/FatApiConstants.h:121:15: note: 'sdfat::LS_R'

const uint8_t LS_R = 8;

           ^

card_check:99:18: error: 'LS_DATE' was not declared in this scope

root.ls(LS_R | LS_DATE | LS_SIZE);

              ^

C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:99:18: note: suggested alternative:

In file included from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/FatFile.h:36:0,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/ArduinoFiles.h:33,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/FatLib.h:27,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdFat.h:33,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SDFS\src/SDFS.h:36,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SD\src/SD.h:25,

             from C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:21:

C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/FatApiConstants.h:117:15: note: 'sdfat::LS_DATE'

const uint8_t LS_DATE = 2;

           ^

card_check:99:28: error: 'LS_SIZE' was not declared in this scope

root.ls(LS_R | LS_DATE | LS_SIZE);

                        ^

C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:99:28: note: suggested alternative:

In file included from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/FatFile.h:36:0,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/ArduinoFiles.h:33,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/FatLib.h:27,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/SdFat.h:33,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SDFS\src/SDFS.h:36,

             from C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SD\src/SD.h:25,

             from C:\Users\George\Documents\Sketch Folder\Card_Check\card_check\card_check.ino:21:

C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat\src/FatLib/FatApiConstants.h:119:15: note: 'sdfat::LS_SIZE'

const uint8_t LS_SIZE = 4;

           ^

Multiple libraries were found for "SPI.h"
Used: C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SPI
Multiple libraries were found for "SD.h"
Used: C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SD
Not used: C:\Program
Not used: C:\Users\George\Documents\Arduino\libraries\SD
Multiple libraries were found for "SDFS.h"
Used: C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\SDFS
Multiple libraries were found for "SdFat.h"
Used: C:\Users\George\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\ESP8266SdFat
exit status 1
'Sd2Card' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Dominant language
C++
Stars
560
Forks
226
PR merge metrics
No merged PRs in 30d

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wemos/D1_mini_Examples

All issues in wemos/D1_mini_Examples

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.