这个问题在这里已经有了答案:Cannot#includeinVisualStudio2005(4个回答)关闭2个月前。我想使用#include在我的代码中,但发生了这个错误:Cannotopenincludefile:'dirent.h':Nosuchfileordirectory我该如何解决这个问题? 最佳答案 因为这个头文件没有随MSVC一起提供。因此它找不到它!它带有CPOSIX库。wikipedia说,dirent.hisknowntobeincludedinthefollowingcompilers:TurboC++(DO