开发者

<dirent.h> in Visual Studio 2010 or 2008 [duplicate]

This question already has answers here: Cannot #include <dirent.h> in Visual Studio 2005 (4 answers) Closed 6 months ago.

I wa开发者_C百科nt 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?


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.


This is another light-weight dirent.h implementation for Windows. It is two files that you can just drop in as-is.

Currently, the best way of getting full POSIX support on Windows is probably Cygwin or its friends.

There is Windows Services for UNIX (SfU), but according to some it was quite close to what Cygwin was in 2006. Seeing how Cygwin and some of its comrads are live and well and SfU did not see an update in over half a decade, I would choose the former any day of the week.

If you are interested in a blast from the past, checkout this little nugget from 2006 which is Microsoft's official How to port from UNIX to Windows website. It seems rather useless, but funny what Microsoft thought is "useful" in 2006.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜