error 30:1 "does not name a type"

Could You help me please.

I get the above error, and dont understand what is wrong

#include <Adafruit_ILI9341.h>

#include <Adafruit_GFX.h>

#include <Adafruit_ILI9341.h>

#include <Adafruit_GFX_AS.h>
#include <Font16.h>
#include <Font32.h>
#include <Font64.h>
#include <Font72.h>
#include <Font7s.h>
#include <Load_fonts.h>

// Spiro
// Rainbow patern generator
// Alan Senior 22/2/15

#include "SPI.h"
#include "Adafruit_GFX_AS.h"
#include "Adafruit_ILI9341_AS.h"

#define sclk 13  // Don't change
#define mosi 11  // Don't change
#define cs   10
#define dc   9
#define rst  7  // you can also connect this to the Arduino reset

#define ILI9341_GREY 0x7BEF
Adafruit_ILI9341_AS tft = Adafruit_ILI9341_AS(cs, dc, rst);       // Invoke custom library

unsigned long runTime = 0;

float sx = 0, sy = 0;
uint16_t x0 = 0, x1 = 0, y0 = 0, y1 = 0;

void setup()
{
  randomSeed(analogRead(A0));
  pinMode(7, OUTPUT);
  digitalWrite(7, LOW);
  delay(10);
  digitalWrite(7, HIGH);
  // Setup the LCD
  tft.init();
  tft.setRotation(3);
}

void loop()
{
  runTime = millis();

  tft.fillScreen(ILI9341_BLACK);
  int n = random(2, 19), r = random(20, 100), colour = 0; //rainbow();
  
  for (long i = 0; i < (360 * n); i++) {
    sx = cos((i / n - 90) * 0.0174532925);
    sy = sin((i / n - 90) * 0.0174532925);
    x0 = sx * (120 - r) + 159;
    y0 = sy * (120 - r) + 119;


    sy = cos(((i % 360) - 90) * 0.0174532925);
    sx = sin(((i % 360) - 90) * 0.0174532925);
    x1 = sx * r + x0;
    y1 = sy * r + y0;
    tft.drawPixel(x1, y1, rainbow(i % 128)); //colour);
  }
  
  r = random(20, 100);//r = r / random(2,4);
  for (long i = 0; i < (360 * n); i++) {
    sx = cos((i / n - 90) * 0.0174532925);
    sy = sin((i / n - 90) * 0.0174532925);
    x0 = sx * (120 - r) + 159;
    y0 = sy * (120 - r) + 119;


    sy = cos(((i % 360) - 90) * 0.0174532925);
    sx = sin(((i % 360) - 90) * 0.0174532925);
    x1 = sx * r + x0;
    y1 = sy * r + y0;
    tft.drawPixel(x1, y1, rainbow(i % 128)); //colour);
  }


  delay(2000);
}

unsigned int rainbow(int value)
{
  // Value is expected to be in range 0-127
  // The value is converted to a spectrum colour from 0 = blue through to red = blue
  //int value = random (128);
  byte red = 0; // Red is the top 5 bits of a 16 bit colour value
  byte green = 0;// Green is the middle 6 bits
  byte blue = 0; // Blue is the bottom 5 bits

  byte quadrant = value / 32;

  if (quadrant == 0) {
    blue = 31;
    green = 2 * (value % 32);
    red = 0;
  }
  if (quadrant == 1) {
    blue = 31 - (value % 32);
    green = 63;
    red = 0;
  }
  if (quadrant == 2) {
    blue = 0;
    green = 63;
    red = value % 32;
  }
  if (quadrant == 3) {
    blue = 0;
    green = 63 - 2 * (value % 32);
    red = 31;
  }
  return (red << 11) + (green << 5) + blue;
}

(deleted)

Post the complete error message. It also told you which file and line number it was mad about. I don't want to have to hunt through a bunch of code to find it.

Probably not the cause of your error, but it jumps out to me that you #include the Adafruit_ILI9341.h lib twice.

--Michael

How is it possible to copy the error Messages?

Here the screenshot:

Could You give me a recommendation, how and where to store the libraries?

Would You store them in the file of Your sketch?

To copy and paste, highlight the text and press Control-C. To paste Control-V. It's no different from any other program out there.

Have you read the page on this site about libraries? They have a couple of specific places they can go.

The error is "tft does not name a type", NOT "30.1 does not name a type". The 30 is the line number where you use a variable with no type, and 1 is the column where that happens.

Delta_G:
To copy and paste, highlight the text and press Control-C. To paste Control-V. It's no different from any other program out there.

No, this does not work.

PaulS:
The error is "tft does not name a type", NOT "30.1 does not name a type". The 30 is the line number where you use a variable with no type, and 1 is the column where that happens.

I know all of above, but this does not help to solve the Problem.

Gregor6712:
I know all of above, but this does not help to solve the Problem.

Sure it does. Look at the line.

Adafruit_ILI9341_AS tft = Adafruit_ILI9341_AS(cs, dc, rst);       // Invoke custom library

The compiler is telling you that it has a variable, tft, for which it can not determine the type. That means that it has no idea what a Adafruit_ILI9341_AS is.

I don't, either. Now, you do try to include a header file with that name, but I'm guessing that you don't actually have that library, or that you have not installed it correctly (in the proper place).

Now this helps, thank You.

I do have that library and I did added it into Arduino. This is a library for a QVGA Adafruit TFT Screen withth ILI9341 IC.

Since I have several libraries, what is the best area to store them? Is that a good idea to store them in the file where the sketch is?

By the way, this is what I´m working on: a small help for flying IFR.

This Setup is reading my checklists, remembering me of switching tanks, showing the flap Position and telling it, so I do not Need to check, etc....

Checklist generator for IFR

Since I have several libraries, what is the best area to store them?

The libraries folder in the same folder as the sketch folders.