Cant access all parts of library when changing folder of h / cpp

Hi,

I want to build my own library, using the FastLED-Library. Problem is, I get a strange error when calling same function with cpp and header located in a different folder:

error: no matching function for call to 'CFastLED::addLeds(CRGB*&, int)
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS)

From the beginning: I start a new project with VisualMicro (same with Arduino IDE). I add cpp and header with the basic example:

.h

#pragma once

#include <Arduino.h>
#include <FastLED.h>
//#include "C:\Users\Inso\Documents\Arduino\libraries\FastLED\FastLED.h"

#define DATA_PIN 5
#define NUM_LEDS 22

class bt
{
private:

	CRGB * leds;

public:
	bt();
};

.cpp

#include "bt.h"



bt::bt()
{
	leds = new CRGB[NUM_LEDS];
	FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
}
{
}

this code builds fine (cpp and h in same folder).
Now I want the same code (as a test) in library-folder. cpp and header with same code. Including the FastLED-library is successful (otherwise I would get different error codes, also tried with full path and filename, no difference).
Building this results in

error: no matching function for call to 'CFastLED::addLeds(CRGB*&, int)
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS)

Within the FastLED.h, it should call-up (in my case, as far as I can read the code)

Line 105
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812B : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};

Line 300
template<template<uint8_t DATA_PIN, EOrder RGB_ORDER> class CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER>
static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
static CHIPSET<DATA_PIN, RGB_ORDER> c;
return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
}

I cannot see the problem, as the include seems to be successful. Do I miss an include or something?

You need to include the FastLED header file in the .cpp file of your library.

You have probably included the FastLED header file in your .ino file, but that is no help to your library source files.

boylesg:
You need to include the FastLED header file in the .cpp file of your library.

You have probably included the FastLED header file in your .ino file, but that is no help to your library source files.

Hiho,

thanks for the reply.

I have the Lib included in the header of the class of my library, as I declare the CRGB array there.
Then the header is included in the cpp file.

I have also tried to also include the FastLED.h within the cpp file, sadly it did not solve the problem. Also only declaring within within cpp and adding FastLED only there - same problem.

HereĀ“s more of the error list, maybe someone sees the problem:

LEDSystem.cpp: 15:56: error: no matching function for call to 'CFastLED::addLeds(CRGB*&, int)
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS)

LEDSystem.h:5: In file included from
LEDSystem.cpp:1: from
FastLED.h:223: note candidate template<ESPIChipsets CHIPSET, unsigned char DATA_PIN, unsigned char CLOCK_PIN, EOrder RGB_ORDER, unsigned char SPI_DATA_RATE> CLEDController& CFastLED addLeds(CRGB*, int, int)
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER, uint8_t SPI_DATA_RATE > CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
FastLED.h:223: note template argument deduction\substitution failed

LEDSystem.cpp: 15:56: error: could not convert template argument 'WS2812B' to 'ESPIChipsets
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS)

LEDSystem.h:5: In file included from
LEDSystem.cpp:1: from
FastLED.h:237: note candidate template<ESPIChipsets CHIPSET, unsigned char DATA_PIN, unsigned char CLOCK_PIN> static CLEDController& CFastLED addLeds(CRGB*, int, int)
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
FastLED.h:237: note template argument deduction\substitution failed

LEDSystem.cpp: 15:56: error: could not convert template argument 'WS2812B' to 'ESPIChipsets
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS)

LEDSystem.h:5: In file included from
LEDSystem.cpp:1: from
FastLED.h:251: note candidate template<ESPIChipsets CHIPSET, unsigned char DATA_PIN, unsigned char CLOCK_PIN, EOrder RGB_ORDER> static CLEDController& CFastLED addLeds(CRGB*, int, int)
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
FastLED.h:251: note template argument deduction\substitution failed

LEDSystem.cpp: 15:56: error: could not convert template argument 'WS2812B' to 'ESPIChipsets
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS)

LEDSystem.h:5: In file included from
LEDSystem.cpp:1: from
FastLED.h:301: note candidate template<template<unsigned char DATA_PIN, EOrder RGB_ORDER> class CHIPSET, unsigned char DATA_PIN, EOrder RGB_ORDER> static CLEDController& CFastLED addLeds(CRGB*, int, int)
static CLEDController &addLeds(struct CRGB data, int nLedsOrOffset, int nLedsIfOffset = 0) {
FastLED.h:301: note template argument deduction\substitution failed
FastLED.h:307: note candidate template<template<unsigned char DATA_PIN, EOrder RGB_ORDER> class CHIPSET, unsigned char DATA_PIN> static CLEDController& CFastLED addLeds(CRGB
, int, int)
static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
FastLED.h:307: note template argument deduction\substitution failed

LEDSystem.cpp: 15:56: error: wrong number of template arguments (3, should be 2)
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS)

LEDSystem.h:5: In file included from
LEDSystem.cpp:1: from
FastLED.h:313: note candidate template<template class CHIPSET, unsigned char DATA_PIN> static CLEDController& CFastLED addLeds(CRGB*, int, int)
static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
FastLED.h:313: note template argument deduction\substitution failed

LEDSystem.cpp: 15:56: error: wrong number of template arguments (3, should be 2)
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS)

LEDSystem.h:5: In file included from
LEDSystem.cpp:1: from
FastLED.h:349: note candidate template<template class CHIPSET, EOrder RGB_ORDER> static CLEDController& CFastLED addLeds(CRGB*, int, int)
static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
FastLED.h:349: note template argument deduction\substitution failed

LEDSystem.cpp: 15:56: error: wrong number of template arguments (3, should be 2)
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS)