Self-written library cannot find config.h

Hi I have a self-written library which needs some configuration through a config.h header file. VSCode is able to find the file and shows no errors but during the build, the config.h file is not found.

Here is my simple project structure:

├── lib/
│   └── MyLibrary/
│       ├── MyLibrary.h
│       └── MyLibrary.c
├── src/
│   └── main.c
├── include/
│   └── config.h
├── test/
└── platformio.ini

The main.c is build with the #include “config.h” line but the MyLibrary.c throws an error during the build.

lib/can/can_lib.c:16:10: fatal error: config.h: No such file or directory
 #include "config.h"

Here is my platformio.ini:

platform = atmelavr
board = AT90CAN128
upload_flags = -e
upload_protocol = jtagmkI
monitor_port = //dev/cu.usbserial-ftE233T8
monitor_speed = 38400

How can I pass the definitions from the config.h to the main.c and MyLibrary.c in a correct way? Does anyone have a tip for me?

Merry Christmas

See responses in

1 Like