# how do I set up linux headers with cmake in vscode ? ubuntu

**URL:** <https://discourse.cmake.org/t/how-do-i-set-up-linux-headers-with-cmake-in-vscode-ubuntu/10461>\
**Category:** Code\
**Created:** [March 23, 2024, 6:59pm UTC](https://discourse.cmake.org/t/how-do-i-set-up-linux-headers-with-cmake-in-vscode-ubuntu/10461 "2024-03-23T18:59:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WaltOnline](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/9dc877/32.png) [@WaltOnline](https://discourse.cmake.org/u/WaltOnline)\
**Post date:** [March 23, 2024, 6:59pm UTC](https://discourse.cmake.org/t/how-do-i-set-up-linux-headers-with-cmake-in-vscode-ubuntu/10461/1 "2024-03-23T18:59:16Z")

</div>

Hi!  
I have a hard time setting a correct paths with cmake for “linux headers”.  
I installed linux 24 and those 2 directories were already there in “/usr/src/” directory,

> linux-headrs-6.8.0-11  
> linux-headers-6.8.0-11-generic

then I installed build-essential package  
after that I created simple cmake project in vscode and tried to include those headers  
but it gives errors that headers isn’t found rwonce.h , pid.h … in other words lot of errors

Can please anyone tell me how to prepare cmake/vscode correctly for linux kernel development and automatically include all headers and dependencies in cmake ?

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [April 11, 2024, 12:10am UTC](https://discourse.cmake.org/t/how-do-i-set-up-linux-headers-with-cmake-in-vscode-ubuntu/10461/2 "2024-04-11T00:10:53Z")

</div>

`/usr/src` is not a directory searched for by default. You’ll need to add the right path to `target_include_directories` or `include_directories` (probably found using `find_file`) so that the compiler knows to look in the right place(s).
