Problems from tutorial book

HI!
I’m doing a toturial book to learn coding with arduino. There are some problem with the code from the book. I have tried to type the code from the book and also fond the example files on Github.
The code will not compile.

/*
  Example sketch FruitPickers3.ino version 7.01.
  From Kjell & Company's book "Hur funkar Arduino?" version 7.01.
  From Kjell & Company's book "Hvordan virker Arduino?" version 7.01.

  This code is in the public domain.
*/



// Include the button library
#include <Button.h>

// Create a button object for each GPIO pin in use
Button btnAddLittleBasketAlice(5);
Button btnAddLittleBasketBob(4);
Button btnAddBigBasketAlice(3);
Button btnAddBigBasketBob(2);

// Declare global variables for total number of apples.
unsigned int fruitsAlice;
unsigned int fruitsBob; 

// Declare global constants for number of apples in baskets.
const int littleBasketSize = 25;
const int bigBasketSize = 40;

// Declare global fruit string
String fruit = " apples";

void setup() {
  
  // Open serial connection at 9600 Bd.
  Serial.begin(9600);

  // Start buttons
  btnAddLittleBasketAlice.begin();
  btnAddLittleBasketBob.begin();
  btnAddBigBasketAlice.begin();
  btnAddBigBasketBob.begin();
}

void loop() {
  
  // Add little basket to Alice
  if(btnAddLittleBasketAlice.pressed()) {
    fruitsAlice = fruitsAlice + littleBasketSize;
    Serial.print("Alice has picked: ");
    Serial.print(fruitsAlice);
    Serial.println(fruit);
    Serial.print("Bob has picked: ");
    Serial.print(fruitsBob);
    Serial.println(fruit);
    Serial.println("------------------------------");
  }

  // Add little basket to Bob
  if(btnAddLittleBasketBob.pressed()) {
    fruitsBob = fruitsBob + littleBasketSize;
    Serial.print("Alice has picked: ");
    Serial.print(fruitsAlice);
    Serial.println(fruit);
    Serial.print("Bob has picked: ");
    Serial.print(fruitsBob);
    Serial.println(fruit);
    Serial.println("------------------------------");
  }

  // Add big basket to Alice
  if(btnAddBigBasketAlice.pressed()) {
    fruitsAlice = fruitsAlice + bigBasketSize;
    Serial.print("Alice has picked: ");
    Serial.print(fruitsAlice);
    Serial.println(fruit);
    Serial.print("Bob has picked: ");
    Serial.print(fruitsBob);
    Serial.println(fruit);
    Serial.println("------------------------------");
  }  

  // Add big basket to Bob
  if(btnAddBigBasketBob.pressed()) {
    fruitsBob = fruitsBob + bigBasketSize;
    Serial.print("Alice has picked: ");
    Serial.print(fruitsAlice);
    Serial.println(fruit);
    Serial.print("Bob has picked: ");
    Serial.print(fruitsBob);
    Serial.println(fruit);
    Serial.println("------------------------------");
  }
}

There is a lot of deffects in the code.

Any help to debug the code would be nice.

Speedyzhen

Speedyzhen:
The code will not compile.

Please post the error message that you get.

Also please post a link to where you got the program.

...R

There is a lot of deffects in the code

Care to share?

(deleted)

and read this too (is this the Button Library they use ?)

Here is the error message:
For me is seams like is something about naming that causes the problems.

Arduino:1.8.5 (Windows 10), Kort"Arduino/Genuino Uno"

Fruit_Pickers_3.int:23: error: 'btnAddLittleBasketAlice' does not name a type

Fruit_Pickers_3.int:24: error: 'btnAddLittleBasketBob' does not name a type

Fruit_Pickers_3.int:25: error: 'btnAddBigBasketAlice' does not name a type

Fruit_Pickers_3.int:26: error: 'btnAddBigBasketBob' does not name a type

C:\Users\Eier\Documents\Arduino\Lære å kode (oppgaver)\Biblioteker\Fruit_Pickers_3.int\Fruit_Pickers_3.int.ino: In function 'void loop()':

Fruit_Pickers_3.int:35: error: expected ';' before 'Serial'

Fruit_Pickers_3.int:44: error: 'btnAddLittleBasketBob' was not declared in this scope

Fruit_Pickers_3.int:50: error: 'fruitbob' was not declared in this scope

Fruit_Pickers_3.int:55: error: 'btnAddBibBasketAlice' was not declared in this scope

Fruit_Pickers_3.int:56: error: 'bigBasketAliceSize' was not declared in this scope

Fruit_Pickers_3.int:67: error: 'btnAddBibBaskedBob' was not declared in this scope

Fruit_Pickers_3.int:67: error: expected primary-expression before '}' token

C:\Users\Eier\Documents\Arduino\Lære å kode (oppgaver)\Biblioteker\Fruit_Pickers_3.int\Fruit_Pickers_3.int.ino: At global scope:

Fruit_Pickers_3.int:68: error: 'fruitsBob' does not name a type

Fruit_Pickers_3.int:69: error: 'Serial' does not name a type

Fruit_Pickers_3.int:70: error: 'Serial' does not name a type

Fruit_Pickers_3.int:71: error: 'Serial' does not name a type

Fruit_Pickers_3.int:72: error: 'Serial' does not name a type

Fruit_Pickers_3.int:73: error: 'Serial' does not name a type

Fruit_Pickers_3.int:74: error: 'Serial' does not name a type

Fruit_Pickers_3.int:75: error: 'Serial' does not name a type

Fruit_Pickers_3.int:76: error: expected declaration before '}' token

exit status 1
'btnAddLittleBasketAlice' does not name a type

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

What exactely is the content of the folder "Fruit_Pickers_3.int"? May there be other *.ino files in that folder which are merged into the sketch you are trying to compile? Also, I would remove ".int" both from the folder name (Fruit_Pickers_3.int) and the sketch name (Fruit_Pickers_3.int.ino).

which Button library did you install ?

Yes it is this button they use.

The button they use in the book is: Button by Micheal Adams

I installed this library and compiled the code below (from your link) without any warning (for a UNO)

you must have done something weird with your IDE or not installed the library in the right way

/*
  Example sketch FruitPickers3.ino version 7.01.
  From Kjell & Company's book "Hur funkar Arduino?" version 7.01.
  From Kjell & Company's book "Hvordan virker Arduino?" version 7.01.
  This code is in the public domain.
*/



// Include the button library
#include <Button.h>

// Create a button object for each GPIO pin in use
Button btnAddLittleBasketAlice(5);
Button btnAddLittleBasketBob(4);
Button btnAddBigBasketAlice(3);
Button btnAddBigBasketBob(2);

// Declare global variables for total number of apples.
unsigned int fruitsAlice;
unsigned int fruitsBob; 

// Declare global constants for number of apples in baskets.
const int littleBasketSize = 25;
const int bigBasketSize = 40;

// Declare global fruit string
String fruit = " apples";

void setup() {
  
  // Open serial connection at 9600 Bd.
  Serial.begin(9600);

  // Start buttons
  btnAddLittleBasketAlice.begin();
  btnAddLittleBasketBob.begin();
  btnAddBigBasketAlice.begin();
  btnAddBigBasketBob.begin();
}

void loop() {
  
  // Add little basket to Alice
  if(btnAddLittleBasketAlice.pressed()) {
    fruitsAlice = fruitsAlice + littleBasketSize;
    Serial.print("Alice has picked: ");
    Serial.print(fruitsAlice);
    Serial.println(fruit);
    Serial.print("Bob has picked: ");
    Serial.print(fruitsBob);
    Serial.println(fruit);
    Serial.println("------------------------------");
  }

  // Add little basket to Bob
  if(btnAddLittleBasketBob.pressed()) {
    fruitsBob = fruitsBob + littleBasketSize;
    Serial.print("Alice has picked: ");
    Serial.print(fruitsAlice);
    Serial.println(fruit);
    Serial.print("Bob has picked: ");
    Serial.print(fruitsBob);
    Serial.println(fruit);
    Serial.println("------------------------------");
  }

  // Add big basket to Alice
  if(btnAddBigBasketAlice.pressed()) {
    fruitsAlice = fruitsAlice + bigBasketSize;
    Serial.print("Alice has picked: ");
    Serial.print(fruitsAlice);
    Serial.println(fruit);
    Serial.print("Bob has picked: ");
    Serial.print(fruitsBob);
    Serial.println(fruit);
    Serial.println("------------------------------");
  }  

  // Add big basket to Bob
  if(btnAddBigBasketBob.pressed()) {
    fruitsBob = fruitsBob + bigBasketSize;
    Serial.print("Alice has picked: ");
    Serial.print(fruitsAlice);
    Serial.println(fruit);
    Serial.print("Bob has picked: ");
    Serial.print(fruitsBob);
    Serial.println(fruit);
    Serial.println("------------------------------");
  }
}

Thanks for the help J-M-L.