How can I list files and directories using NVCC compiler?

I wanted to compile the cuda codes using NVCC for directory and file management. Specifically, I use dirent.h for directory management (to open the directory, list the files and so on). I tried to compile the C++ codes using NVCC compiler and run the executables on nvidia Jetson. I have lots of compilation errors. The main error message is below. Any idea to fix the compilation error? Can NVCC compile the direct.h and to use the directory management functions in the executable file running on Jetson?

It seemed “filesystem” can not be compiled and used as well. Any idea how I manage the directory and files for the cuda using NVCC?

dirent.h:413:28: error: missing binary operator before token “(”
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)