Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Library with ESP-IDF and arduino #60

Open
MarleyPlant opened this issue Jul 11, 2024 · 1 comment
Open

Using Library with ESP-IDF and arduino #60

MarleyPlant opened this issue Jul 11, 2024 · 1 comment

Comments

@MarleyPlant
Copy link

I have an ESP-IDF project for the ESP32-c6, I have the arduino-esp32 component added through the component registry and then have placed ESP32Servo in components folder with the following CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
idf_component_register(SRCS "src/ESP32PWM.h" "src/ESP32Servo.h"
                    INCLUDE_DIRS "src/."
                    REQUIRES "arduino-esp32" # Library requires Arduino
                    )

project(ESP32Servo)

my main CMakeLists.txt file is as follows

set(COMPONENT_REQUIRES "WebSockets")
set(COMPONENT_REQUIRES "THERMISTOR")
set(COMPONENT_REQUIRES "ESP32Servo")


idf_component_register(
    SRCS "main.cpp"
    INCLUDE_DIRS ""
)

when trying to build the project I get the following error.

components/ESP32Servo/src/ESP32Servo.h:129: undefined reference to `ESP32PWM::~ESP32PWM()'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

any ideas what I am doing wrong?

@madhephaestus
Copy link
Owner

The destructor is explicitly defined in

ESP32PWM::~ESP32PWM() {

Maybe look at SRCS "src/ESP32PWM.h" "src/ESP32Servo.h" INCLUDE_DIRS "src/." It looks like you set the src dir as the search dir, then say the headers are relative path of src/... I think this would result in it looking for the headers in src/src/ESP32Servo.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants