Can somebody compile web server example?

link from site to ethernet example

and here is example

I can not compile this code! But why?

Error: ‘Sd2Card’ does not name a type

How to fix it? :o

May be I need to include sources of these libraries ?

 * This sketch will list all files in the root directory and 
 * then do a recursive list of all directories on the SD card.

#include <SdFat.h>
#include <SdFatUtil.h>
#include <Ethernet.h>

/************ ETHERNET STUFF ************/
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 177 };
Server server(80);

/************ SDCARD STUFF ************/
Sd2Card card;
SdVolume volume;
SdFile root;

// store error strings in flash to save RAM
#define error(s) error_P(PSTR(s))

void error_P(const char* str) {
  PgmPrint("error: ");
  if (card.errorCode()) {
    PgmPrint("SD error: ");
    Serial.print(card.errorCode(), HEX);
    Serial.println(card.errorData(), HEX);

void setup() {
  PgmPrint("Free RAM: ");
  // initialize the SD card at SPI_HALF_SPEED to avoid bus errors with
  // breadboards.  use SPI_FULL_SPEED for better performance.
  pinMode(10, OUTPUT);                       // set the SS pin as an output (necessary!)
  digitalWrite(10, HIGH);                    // but turn off the W5100 chip!

  if (!card.init(SPI_HALF_SPEED, 4)) error("card.init failed!");
  // initialize a FAT volume
  if (!volume.init(&card)) error("vol.init failed!");

  PgmPrint("Volume is FAT");
  if (!root.openRoot(&volume)) error("openRoot failed");

  // list file in root with date and size
  PgmPrintln("Files found in root:"); | LS_SIZE);
  // Recursive list of all directories
  PgmPrintln("Files found in all dirs:");;
  // Debugging complete, we start the server!
  Ethernet.begin(mac, ip);

void ListFiles(Client client, uint8_t flags) {
  // This code is just copied from SdFile.cpp in the SDFat library
  // and tweaked to print to the client output in html!
  dir_t p;
  while (root.readDir(p) > 0) {
    Serial.print("read file");
    // done if past last used entry
    if ([0] == DIR_NAME_FREE) break;

    // skip deleted entry and entries for . and  ..
    if ([0] == DIR_NAME_DELETED ||[0] == '.') continue;

    // only list subdirectories and files
    if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue;

    // print any indent spaces
    client.print(' ');

    // print file name with possible blank fill
    //root.printDirName(*p, flags & (LS_DATE | LS_SIZE) ? 14 : 0);

    uint8_t w = 0;
    for (uint8_t i = 0; i < 11; i++) {
      if ([i] == ' ') continue;
      if (i == 8) {
    if (DIR_IS_SUBDIR(&p)) {

    // print modify date/time if requested
    if (flags & LS_DATE) {
       client.print(' ');
    // print size if requested
    if (!DIR_IS_SUBDIR(&p) && (flags & LS_SIZE)) {
      client.print(' ');

void loop()
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    while (client.connected()) {
      if (client.available()) {
        char c =;
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so we can send a reply
        if (c == '\n' && current_line_is_blank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          // print all the files, use a helper to keep it clean
          //ListFiles(client, 0);
          ListFiles(client, 0);
        if (c == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        } else if (c != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;
    // give the web browser time to receive the data

#include <SdFat.h>
#include <SdFatUtil.h>

How does compiler know where are this includes files??? And why he did not tell me about them?

If you use the Sketch + Import Library... menu item, you will see all the libraries that the Arduino knows how to include (because it knows how to find them).

Did you download the SdFat library? Where did you put it?

Use your OS's file explorer capability, and locate one of the directories that the IDE knows how to find. Put SdFat in that same place.