Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

FastLED library linker errors #82

@KevinRhyne

Description

@KevinRhyne

Hi,

I'm trying to use the FastLED library with Arduino-CMake-NG and getting linker errors while attempting to link FastLED.

My make output:

[ 80%] Built target nano_atmega328_core_lib
[ 83%] Built target fast_led
[ 87%] Linking CXX executable Rhyne_LED.elf
/var/folders/_3/m56nwyn16qq5wmyny1ntss940000gn/T//ccZwq6tt.ltrans0.ltrans.o: In function `__base_ctor ':
/Users/rhyne/workspace/arduino/rhyne-led/lib/FastLED/controller.h:67: undefined reference to `CLEDController::m_pHead'
/Users/rhyne/workspace/arduino/rhyne-led/lib/FastLED/controller.h:67: undefined reference to `CLEDController::m_pHead'
/Users/rhyne/workspace/arduino/rhyne-led/lib/FastLED/controller.h:67: undefined reference to `CLEDController::m_pHead'
/Users/rhyne/workspace/arduino/rhyne-led/lib/FastLED/controller.h:67: undefined reference to `CLEDController::m_pHead'
/Users/rhyne/workspace/arduino/rhyne-led/lib/FastLED/controller.h:68: undefined reference to `CLEDController::m_pTail'
/Users/rhyne/workspace/arduino/rhyne-led/lib/FastLED/controller.h:68: undefined reference to `CLEDController::m_pTail'
/Users/rhyne/workspace/arduino/rhyne-led/lib/FastLED/controller.h:69: undefined reference to `CLEDController::m_pTail'
/Users/rhyne/workspace/arduino/rhyne-led/lib/FastLED/controller.h:69: undefined reference to `CLEDController::m_pTail'
/var/folders/_3/m56nwyn16qq5wmyny1ntss940000gn/T//ccZwq6tt.ltrans0.ltrans.o: In function `addLeds':
/Users/rhyne/workspace/arduino/rhyne-led/lib/FastLED/FastLED.h:305: undefined reference to `CFastLED::addLeds(CLEDController*, CRGB*, int, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [Rhyne_LED.elf] Error 1
make[1]: *** [CMakeFiles/Rhyne_LED.dir/all] Error 2
make: *** [all] Error 2

My CMakeLists.txt is as follows:

cmake_minimum_required(VERSION 3.8.2)

project( Rhyne_LED LANGUAGES C CXX )

get_board_id( board_id nano atmega328 )

file(GLOB SOURCES "src/*.cpp")
file(GLOB HEADERS "src/*.h")

add_arduino_executable( Rhyne_LED ${board_id} ${SOURCES} ${HEADERS})

add_arduino_library(fast_led ${board_id} lib/FastLED/FastLED.h)
link_arduino_library(Rhyne_LED fast_led ${board_id})

My main.cpp is as follows:

#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 256

void loop() {}

CRGB leds[NUM_LEDS];

void setup() {
    FastLED.addLeds<WS2812B, DATA_PIN>( leds, NUM_LEDS );
}

Apologies in advance if this is due to my limited understanding of project structure. Any help would be greatly appreciated! Thank you!

OS: macOS
OS Version: High Sierra
Platform: Arduino Nano atmega328
Platform SDK Version: 1.8.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions