expected constructor, destructor, or type conversion before '=' token error

Received the "expected constructor, destructor, or type conversion before '=' token error" when trying to compile an example sketch from adafruit for their neopixel ring.

#include <Adafruit_NeoPixel.h>

int topLED = 1;
int hours = 1;
int minutes = 0;
int seconds = 0;
int buttonPin = 1;
int buttonState;
int lastButtonState = HIGH;
long buttonHoldTime = 0;
long buttonHoldDelay = 2500;
int lastCombined = 0;
strip = Adafruit_NeoPixel(16, 6, NEO_GRB + NEO_KHZ800);

void setup() {
  Serial.begin(9600);
  pinMode(buttonPin, INPUT);
  digitalWrite(buttonPin, HIGH);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  // read the state of the switch into a local variable:
  int buttonState = digitalRead(buttonPin);
  
  if (buttonState == LOW) {
    buttonCheck();
  }
  
  lastButtonState = buttonState;
  
  for (hours = 1; hours < 13; hours++) {
    for (minutes = 1; minutes < 60; minutes++) {
      for (seconds = 1; seconds < 60; seconds++) {
        Serial.print(hours);
        Serial.print(":");
        Serial.print(minutes);
        Serial.print(":");
        Serial.print(seconds);
        Serial.println(".");
        
        float gpsMin = (minutes + (seconds/60.0));
        unsigned int ledMin = 0;
        int minTemp = 0;
        if (gpsMin <= 1.875) minTemp = topLED;
        if ((gpsMin > 1.875) && (gpsMin <= 5.625)) minTemp = topLED - 1;
        if ((gpsMin > 5.625) && (gpsMin <= 9.375)) minTemp = topLED - 2;
        if ((gpsMin > 9.375) && (gpsMin <= 13.125)) minTemp = topLED - 3;
        if ((gpsMin > 13.125) && (gpsMin <= 16.875)) minTemp = topLED - 4;
        if ((gpsMin > 16.875) && (gpsMin <= 20.625)) minTemp = topLED - 5;
        if ((gpsMin > 20.625) && (gpsMin <= 24.375)) minTemp = topLED - 6;
        if ((gpsMin > 24.375) && (gpsMin <= 28.125)) minTemp = topLED - 7;
        if ((gpsMin > 28.125) && (gpsMin <= 31.875)) minTemp = topLED - 8;
        if ((gpsMin > 31.875) && (gpsMin <= 35.625)) minTemp = topLED - 9;
        if ((gpsMin > 35.625) && (gpsMin <= 39.375)) minTemp = topLED - 10;
        if ((gpsMin > 39.375) && (gpsMin <= 43.125)) minTemp = topLED - 11;
        if ((gpsMin > 43.125) && (gpsMin <= 46.875)) minTemp = topLED - 12;
        if ((gpsMin > 46.875) && (gpsMin <= 50.625)) minTemp = topLED - 13;
        if ((gpsMin > 50.625) && (gpsMin <= 54.375)) minTemp = topLED - 14;
        if ((gpsMin > 54.375) && (gpsMin <= 58.125)) minTemp = topLED - 15;
        if (gpsMin > 58.125) minTemp = topLED - 16;
        
        if (minTemp < 0) {
          ledMin = minTemp + 16;
        } else {
          ledMin = minTemp;
        }
        
        float gpsHour = (hours + (minutes/60.0));
        if (gpsHour > 12) { gpsHour = gpsHour - 12; }
        unsigned int ledHour = 0;
        int hourTemp = 0;
        if (gpsHour <= 0.375) hourTemp = topLED;
        if ((gpsHour > 0.375) && (gpsHour <= 1.125)) hourTemp = topLED - 1;
        if ((gpsHour > 1.125) && (gpsHour <= 1.875)) hourTemp = topLED - 2;
        if ((gpsHour > 1.875) && (gpsHour <= 2.625)) hourTemp = topLED - 3;
        if ((gpsHour > 2.625) && (gpsHour <= 3.375)) hourTemp = topLED - 4;
        if ((gpsHour > 3.375) && (gpsHour <= 4.125)) hourTemp = topLED - 5;
        if ((gpsHour > 4.125) && (gpsHour <= 4.875)) hourTemp = topLED - 6;
        if ((gpsHour > 4.875) && (gpsHour <= 5.625)) hourTemp = topLED - 7;
        if ((gpsHour > 5.625) && (gpsHour <= 6.375)) hourTemp = topLED - 8;
        if ((gpsHour > 6.375) && (gpsHour <= 7.125)) hourTemp = topLED - 9;
        if ((gpsHour > 7.125) && (gpsHour <= 7.875)) hourTemp = topLED - 10;
        if ((gpsHour > 7.875) && (gpsHour <= 8.625)) hourTemp = topLED - 11;
        if ((gpsHour > 8.625) && (gpsHour <= 9.375)) hourTemp = topLED - 12;
        if ((gpsHour > 9.375) && (gpsHour <= 10.125)) hourTemp = topLED - 13;
        if ((gpsHour > 10.125) && (gpsHour <= 10.875)) hourTemp = topLED - 14;
        if ((gpsHour > 10.875) && (gpsHour <= 11.625)) hourTemp = topLED - 15;
        if (gpsHour > 11.625) hourTemp = topLED - 16;
        
        if (hourTemp < 0) {
          ledHour = hourTemp + 16;
        } else {
          ledHour = hourTemp;
        }
    
        if ((ledHour == ledMin) && (lastCombined == 0)) {
          strip.setPixelColor(lastHour, strip.Color(0, 0, 0));
          strip.setPixelColor(lastMin, strip.Color(0, 0, 0));
          strip.setPixelColor(ledHour, strip.Color(255, 0, 255));
          strip.show();
          lastCombined = 1;
          lastHour = ledHour;
          lastMin = ledMin;
        } else {
          if (lastHour != ledHour) {
            strip.setPixelColor(lastHour, strip.Color(0, 0, 0));
            strip.setPixelColor(ledHour, strip.Color(255, 50, 0));
            strip.show();
            lastHour = ledHour;
          }
          if (lastMin != ledMin) {
            strip.setPixelColor(lastMin, strip.Color(0, 0, 0));
            strip.setPixelColor(ledMin, strip.Color(200, 200, 0));
            if (lastCombined == 1) {
              strip.setPixelColor(ledHour, strip.Color(255, 0, 0));
              lastCombined = 0;
            }
            strip.show();
            lastMin = ledMin;
          }
        }   
      } else {
        // if millis() or timer wraps around, we'll just reset it
        if (startupTimer > millis()) startupTimer = millis();
          
        // approximately every 10 seconds or so, update time
        if (millis() - startupTimer > 200) {
          startupTimer = millis(); // reset the timer
          if (startLED == 16) {
            startLED = 0;
          }
          strip.setPixelColor(startLEDlast, strip.Color(0, 0, 0));
          strip.setPixelColor(startLED, strip.Color(0, 255, 0));
          strip.show();
          startLEDlast = startLED;
          startLED++;
          //delay(200);
        }
      }
        delay(20);
      }
    }
  }
}

void buttonCheck() {
  menuTime = millis();
  int buttonState = digitalRead(buttonPin);
  if (buttonState == LOW && lastButtonState == HIGH) {
    buttonHoldTime = millis();
  }
  
  if (buttonState == LOW && lastButtonState == LOW) {
    if ((millis() - buttonHoldTime) > buttonHoldDelay) {
      
      if(mode == 2) {
        mode = 0;
        lastMin = 16;
        lastHour = 16;
        colorWipe(strip.Color(0, 0, 0), 20);
        buttonHoldTime = millis();
      } else {
        mode = mode + 1;
        colorWipe(strip.Color(0, 0, 0), 20);
        buttonHoldTime = millis();
      }
    }
  }
}

The error is for the following code

strip = Adafruit_NeoPixel(16, 6, NEO_GRB + NEO_KHZ800);

Example sketch from adafruit is as follows

#include <Adafruit_NeoPixel.h>

#define PIN 6

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  // Some example procedures showing how to display to the pixels:
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue
  rainbow(20);
  rainbowCycle(20);
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

All help is greatly appreciated.

You have: strip = Adafruit_NeoPixel(16, 6, NEO_GRB + NEO_KHZ800);
The example hasAdafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
They're not the same!

You didn't declare a type or class for the item "strip".

Stepping backward a bit, a C++ data variable (or class) definition has the form

typename variablename = initilizer-statment;

A simple variable might have int sum = 0;
"int" is the variable type (built into the compiler), "sum" is the name of the variable (provided by you), and it's initialized to zero.
For C++, users (or library writers) get to define more complex types, like a neopixel. If you haveAdafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
it says to define a variable of type "Adafruit_NeoPixel" (defined in the library), named "strip", initialized by the "constructor" and arguments after the equals sign. When you leave out the first "Adafruit_NeoPixel" part, you have a statement that trys to assign a value to a variable that has never been created, in a place where assignment statements are not permitted (an initialization statement is not the same as an assignment statement.)

Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

I have seen this sort of thing in sample code. Why not just write:

Adafruit_NeoPixel strip(60, PIN, NEO_GRB + NEO_KHZ800);

This is simpler and avoids a possible unneccessary assignment.

Both

#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip (60, PIN, NEO_GRB + NEO_KHZ800);

and

Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

Give the error "Adafruit_NeoPixel does not name a type. Could it be as simple as not installing the Adafruit Neoppixel library properly?

Could it be as simple as not installing the Adafruit Neoppixel library properly?

Could well be. Try renaming the folder "Neopixel". The Arduino IDE does seem to like special characters in folder names. If necessary restart the IDE after renaming the folder.

Still same issue. error saying it's not a type.

I have just compiled this

#include "Adafruit_NeoPixel.h"
#define PIN 6

Adafruit_NeoPixel strip1 = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

Adafruit_NeoPixel strip2(60, PIN, NEO_GRB + NEO_KHZ800);

void setup(){}
void loop(){}

and it compiled ok. I suggest you check have put the NeoPixel folder in the right place.

ROFL!!! That did it. Library for it was in the wrong folder. Stupid me. Thanks y'all