Alex Rivera | Logout

<dirent.h> in Visual Studio 2010 or 2008

Asked 2011-04-03T16:41:23.810
47

I want to use #include <dirent.h> in my code but this error happens:

Cannot open include file: 'dirent.h': No such file or directory

How can I solve this problem?

Edit
Report

1 Answer

69

Because this header file doesn't come with MSVC. Hence it cannot find it!

It comes with C POSIX library. The wikipedia says,

dirent.h is known to be included in the following compilers:

  • Turbo C++ (DOS)
  • GCC (Cross-platform)
  • MinGW (Microsoft Windows)
  • Borland C++ Builder (Microsoft Windows)

Microsoft Visual C++ does not include dirent.h

However, you can download free Windows implementation of dirent.h which you can use with Microsoft Visual Studio.

answered 2011-04-03T16:42:18.700

Your Answer