idf v4.3 custom component

wedvjin
Posts: 3
Joined: Mon Jan 11, 2021 5:17 pm

idf v4.3 custom component

Postby wedvjin » Tue Jan 12, 2021 1:23 pm

hello,

after creating a new component as follows:

Code: Select all

$ idf.py -C components create-component new_component
I get the following structure:

Code: Select all

.
├── CMakeLists.txt
├── components
│   └── new_component
│       ├── CMakeLists.txt
│       ├── include
│       │   └── new_component.h
│       └── new_component.c
├── main
│   ├── CMakeLists.txt
│   └── main.cpp
└── sdkconfig
However, when including the "new_component.h" in main compiler errors with "No such file or directory".

Components CMakeLists.txt:

Code: Select all

idf_component_register(SRCS "new_component.c"
                    INCLUDE_DIRS "include")

So far tried:
- adding empty REQUIRES in new_component's CMakeLists.txt
- creating component.mk file with the content:

Code: Select all

COMPONENT_SRCDIRS := .
COMPONENT_ADD_INCLUDEDIRS := include
edit: typo
Last edited by wedvjin on Wed Jan 13, 2021 8:37 am, edited 1 time in total.

chegewara
Posts: 2207
Joined: Wed Jun 14, 2017 9:00 pm

Re: idf v4.3 custom component

Postby chegewara » Tue Jan 12, 2021 3:07 pm

There is typo in

Code: Select all

new_componenet
so, the header file is:

Code: Select all

new_componenet.h

wedvjin
Posts: 3
Joined: Mon Jan 11, 2021 5:17 pm

Re: idf v4.3 custom component

Postby wedvjin » Wed Jan 13, 2021 8:39 am

chegewara wrote:
Tue Jan 12, 2021 3:07 pm
There is typo in

Code: Select all

new_componenet
so, the header file is:

Code: Select all

new_componenet.h
chegewara,
thank you for pointing this out
the typo is in a post as the actual component name is short as in "states"

wedvjin
Posts: 3
Joined: Mon Jan 11, 2021 5:17 pm

Re: idf v4.3 custom component

Postby wedvjin » Tue Apr 20, 2021 1:55 pm

The problem was in multi line comments in cmake, as some lines crossed it and made an error.

Who is online

Users browsing this forum: awegel, Baidu [Spider], FrankJensen, StanInexeon, zelenecul and 126 guests