0

Greetings of the day!

I'm new to Zephyr and CMakeLists.txt I'm trying to include Zephyr header files in my project, so I downloaded Zephyr and keeping inside my project to include Zephyr to my project I used CMakeLists.txt in that I used a line like find_package(Zephyr)

It's finding the package but I'm unable to include the headers used inside Zephyr for example $include<sys/crc.h>

It's throws error like No such a file or directory

Folder structure

CMakeLists.txt

Src/main.c

zephyr

In main.c I'm having this line

#include<Zephyr/zephyr.h>// no error

#include<sys/crc.h>// error

In CMakeLists.txt I'm having this line

find_package(Zephyr PATHS Zephyr)

My question is how to use Zephyr header files to my various c files I'm going to implement in future.

Thanks in Advance !

1 Answers1

0

It depends which version of Zephyr you are using. Since recently, all Zephyr include directories are under the zephyr subdirectory, therefore you must replace

#include <sys/crc.h>

with

#include <zephyr/sys/crc.h>

Outside of the question, you don't want to use upper-case letters when including headers from Zephyr, otherwise you will encounter problems on other operating systems. Always match big and small letters exactly with the filename on your disk.

bluv
  • 126
  • 6