"ClassName" does not name a type even if including header file

Hi,
I ran into a problem while writing a LightController
I got the error: "'Profile' does not name a type; did you mean 'tmpfile'?
"
at: static Profile runningProfiles[MAX_RUNNING_PROFILES]; (Class1)

Im guessing i can't compile Class 1 before compiling Class2 and the other way around.
Any way to fix this or am i doing sth wrong?

Thanks in advance, Tello.

Class1:

#ifndef ProfileBuffer_h;
#define ProfileBuffer_h;
#include <FastLED.h>
#include "Arduino.h"
#include "Profiles.h"

class ProfileBuffer{

  public :
    static const int MAX_RUNNING_PROFILES = 5;
    static Profile runningProfiles[MAX_RUNNING_PROFILES];
    static inline int currentlyRunningProfiles = 0; 

  ProfileBuffer(){}

static void checkProfiles(){
  for(int i = 0; i < currentlyRunningProfiles; i++){
    while(runningProfiles[i].finished && runningProfiles[i].id >= 0){
      removeProfile(i);
    }
  }
}
static void removeProfile(int i){
  for(int x = i; x < MAX_RUNNING_PROFILES-1; x++){
    runningProfiles[x] = runningProfiles[x+1];
  }
  runningProfiles[MAX_RUNNING_PROFILES-1].finished = true;
  runningProfiles[MAX_RUNNING_PROFILES-1].id = -1;
  currentlyRunningProfiles--;
  }
};
#endif

Class2:

#ifndef Profiles_h;
#define Profiles_h;
#include <FastLED.h>
#include "Arduino.h";
#include "ProfileBuffer.h"

class Profile{

  public :
  
  static const int profileCount = 4;
  static const int NUM_STRIPS = 4;
  static const int NUM_LEDS_PER_STRIP = 72;
  static const int NUM_LEDS = NUM_STRIPS * NUM_LEDS_PER_STRIP;

  int currentTick;
  int id = -1;
  CRGB color;
  bool finished = false;
  bool cancelOnNew = false;
  
  Profile(){
    finished = true;
    id = -1;
  }
  
  Profile(int id_, CRGB color_){
    id = id_;
    color = color_;
    finished = false;
  }

  void finish(){
    finished = true;
    ProfileBuffer::checkProfiles();
  }
};
#endif

Your 'ProfileBuffer' class does not have a static member function named 'checkProfiles'.

Also, your indenting is atrocious, very difficult to read. Type ctrl-t in the Arduino IDE to auto-format your code.

added the missing method,
Also I didnt know how to correctly import the code to this site.
Formatting should be better now!

anyone?

So what ProfileBuffer object are you planning on checkProfiles() of?

-jim lee

Also you are very restricted when initializing static member variables in a class.
These can be declared in the class but defined and initialized outside the class.

Handled it in another way, thanks anyway!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.