Template argument/substitution error

When I pass the data and clock pins to the library function as in the code below, I get this error:
template argument deduction/substitution failed:
wrong number of template arguments (4, should be 1)

If I define the data and clock pin variables as constants in example.h as such:
#define DATA_PIN 26
#define CLOCK_PIN 25
it works fine. Obviously pin assignments should not be made in the library code.
I left out most of the variable declarations for clarity.

Is there a way to correctly pass the DATA_PIN and CLOCK_PIN parameters to the function?

Thanks in advance.

example.ino
f1 test(NUM_DISPLAYS, 0, 26, 25);



example.h -

public:
public:
f1(uint8_t nDigits, uint8_t nSeparators, uint8_t nDataPin, uint8_t nClockPin);

private:
const uint8_t DATA_PIN;
const uint8_t CLOCK_PIN;
etc.


f1::f1(uint8_t nDigits, uint8_t nSeparators, uint8_t nDataPin, uint8_t nClockPin):NumDigits(nDigits), NumLEDs(nDigits * LEDsPerDigit),NumSeparators(nSeparators), 
NumSeparatorLEDs(nSeparators * LEDsPerSeparator), DATA_PIN(nDataPin), CLOCK_PIN(nClockPin){


example.cpp -
result =&FastLED.addLeds<APA102,DATA_PIN,CLOCK_PIN,COLOR_ORDER>leds,nLED).
setCorrection(TypicalLEDStrip);

Is there a way to correctly pass the DATA_PIN and CLOCK_PIN parameters to the function?

Obviously.

Post a link to the library. We can't guess what the template definition is.

Post some code that actually compiles (has balanced parentheses, brackets, etc.) or post the EXACT error messages.

Both the .cpp and .h files exceed 9000 characters. Here is the exact error message. Hopefully that will help.

In file included from C:\Users\mitch\OneDrive\Arduino\libraries\Lixie\src\Lixie.h:17:0,

                 from C:\Users\mitch\OneDrive\Arduino\libraries\Lixie\src\Lixie.cpp:7:

C:\Users\mitch\OneDrive\Arduino\libraries\FastLED/FastLED.h:345:25: note: candidate: template<template<EOrder RGB_ORDER> class CHIPSET, EOrder RGB_ORDER> static CLEDController& CFastLED::addLeds(CRGB*, int, int)

  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {

                         ^

C:\Users\mitch\OneDrive\Arduino\libraries\FastLED/FastLED.h:345:25: note:   template argument deduction/substitution failed:

C:\Users\mitch\OneDrive\Arduino\libraries\Lixie\src\Lixie.cpp:743:100: error: wrong number of template arguments (4, should be 2)

  controller = &FastLED.addLeds<APA102,DATA_PIN,CLOCK_PIN,COLOR_ORDER>(leds, NumLEDs + NumSeparators).setCorrection(TypicalLEDStrip);

                                                                                                    ^

In file included from C:\Users\mitch\OneDrive\Arduino\libraries\Lixie\src\Lixie.h:17:0,

                 from C:\Users\mitch\OneDrive\Arduino\libraries\Lixie\src\Lixie.cpp:7:

C:\Users\mitch\OneDrive\Arduino\libraries\FastLED/FastLED.h:351:25: note: candidate: template<template<EOrder RGB_ORDER> class CHIPSET> static CLEDController& CFastLED::addLeds(CRGB*, int, int)

  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {

                         ^

C:\Users\mitch\OneDrive\Arduino\libraries\FastLED/FastLED.h:351:25: note:   template argument deduction/substitution failed:

C:\Users\mitch\OneDrive\Arduino\libraries\Lixie\src\Lixie.cpp:743:100: error: wrong number of template arguments (4, should be 1)

  controller = &FastLED.addLeds<APA102,DATA_PIN,CLOCK_PIN,COLOR_ORDER>(leds, NumLEDs + NumSeparators).setCorrection(TypicalLEDStrip);

Both the .cpp and .h files exceed 9000 characters.

So? Use Reply (NOT the Quick Reply field), and the Additional Options link, to attach them.

Hopefully that will help.

Nope.

MitchSF:
Both the .cpp and .h files exceed 9000 characters.

Post an MCVE.

Thank you. Files are attached. They will not compile because of the error previously stated.

I can upload a version with the pins assignments defined, that will compile and work perfectly, if necessary.

Lixie-Counter.ino (374 Bytes)

Lixie.h (3.24 KB)

Lixie.cpp (16.4 KB)

They will not compile because of the error previously stated.

Why don't you fix that error?

You are missing a ( to enclose the arguments.

result =&FastLED.addLeds<APA102,DATA_PIN,CLOCK_PIN,COLOR_ORDER>(leds,nLED).setCorrection(TypicalLEDStrip);

Although I did find one problem, I don't see a missing (. Please let me know where it is missing.

If "DATA_PIN, CLOCK_PIN" are replaced with "25, 26" on the FastLED declaration in the .cpp file, the program compiles and runs perfectly. Attached are the updated files.

Thanks for the help.

Lixie.cpp (16.4 KB)

Lixie.h (3.24 KB)

result =&FastLED.addLeds<APA102,DATA_PIN,CLOCK_PIN,COLOR_ORDER>(leds,nLED).setCorrection(TypicalLEDStrip);
I added the red one that was missing from your code.

constexpr byte Lixie::Addresses[];

What good is a zero element array?

Still haven't seen a link to the FastLED library that seems to be the crux of the problem.

I see. Thanks. That was corrected in the example last attached. Here is the FastLED library:

Posting just some of your errors was what took so long to understand what was going on.

The compiler needs to be able to generate all the code for a templated class at compile time. Since the pin numbers to use are not known AT COMPILE TIME, it can't generate the class code.

Thank you for your help. I'll look into rewriting without a template class.