# Trying to include \<dirent.h\> into my cmake build

**URL:** https://discourse.cmake.org/t/trying-to-include-dirent-h-into-my-cmake-build/8889
**Category:** Usage
**Tags:** os:windows
**Created:** [September 5, 2023, 7:14pm UTC](https://discourse.cmake.org/t/trying-to-include-dirent-h-into-my-cmake-build/8889 "2023-09-05T19:14:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![brody711](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brody711/32/3783_2.png) [@brody711](https://discourse.cmake.org/u/brody711)
#### Post date: [September 5, 2023, 7:14pm UTC](https://discourse.cmake.org/t/trying-to-include-dirent-h-into-my-cmake-build/8889/1 "2023-09-05T19:14:51Z")

</div>

Hello everyone,

I’m very new to using cmake and installed it so that I could use the opencv2 library. However, I need to be able to use the \<dirent.h\> header file which is being pulled from my system path at “C:\msys64\mingw64\include\dirent.h”. I would like to add this library to my build but don’t know how to do so. I have #include \<dirent.h\> on my cpp flile but don’t know what else I should do. Here is my cmake.txt

 ![help](https://discourse.cmake.org/uploads/default/original/2X/d/d83a67e8c85e1a61318cf274edc84f5db81ecfd2.jpeg)

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [September 5, 2023, 10:57pm UTC](https://discourse.cmake.org/t/trying-to-include-dirent-h-into-my-cmake-build/8889/2 "2023-09-05T22:57:59Z")

</div>

It looks like Visual Studio is being used so you’d want their dirent.h. I haven’t seen this problem. Maybe you need to have msys2 gcc.exe on Path. That how I use msys2 gcc from Windows Terminal or Command Prompt.

What compiler are you wanting? GCC or CL?
