[dirent.h]MS C/C++编译器:无法打开包括文件:“dirent.h”

头像
523066680
Administrator
Administrator
帖子: 340
注册时间: 2016年07月19日 12:14
拥有现金: 锁定
储蓄: 锁定
Has thanked: 30 times
Been thanked: 27 times
联系:

[dirent.h]MS C/C++编译器:无法打开包括文件:“dirent.h”

帖子 #1 523066680 » 2017年02月25日 11:36

使用 VS2010 编译环境,cl.exe 编译一个已经写好的程序的时候,提示:

>cl listv1.3_CL.cpp
用于 80x86 的 Microsoft (R) 32 位 C/C++ 优化编译器 16.00.30319.01 版
版权所有(C) Microsoft Corporation。保留所有权利。

listv1.3_CL.cpp
listv1.3_CL.cpp(11) : fatal error C1083: 无法打开包括文件:“dirent.h”: No such file or directory


解决方法,参考:http://softagalleria.net/dirent.php
适合MS编译器的库文件:https://github.com/tronkko/dirent

使用方法:下载后将 dirent.h 复制到对应的包含目录即可,比如
D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\

头像
523066680
Administrator
Administrator
帖子: 340
注册时间: 2016年07月19日 12:14
拥有现金: 锁定
储蓄: 锁定
Has thanked: 30 times
Been thanked: 27 times
联系:

dirent.h for windows Visual Studio Compiler

帖子 #2 523066680 » 2017年03月07日 09:58

http://softagalleria.net/dirent.php 好像挂了

Introduction
Dirent is an application programming interface (API) that enables programmers to list files and directories.
Dirent API is commonly available in UNIX systems but not all compilers in Windows provide it. In particular,
Microsoft Visual Studio lacks a dirent interface.

Thus, if you are porting software to Windows, you may find yourself rewriting code for Microsoft specific APIs.
In order to reduce this work, I have create a clone of the dirent interface for Microsoft Visual Studio.

The interface attempts to mimic the genuine UNIX API so that you could use the familiar UNIX data structures
and function calls in both Windows and UNIX without modifying source code for one platform or the other.

Download & Install
At first, download dirent installation package. The latest version is 1.20.1 (April 2014).

To install dirent, unpack the zip file and copy includes/dirent.h file to system include directory.
System include directory contains header files such as assert.h and windows.h, and it is usually located at
C:\Program Files\Microsoft Visual Studio 9.0\VC\include

Dirent API is implemented completely in the dirent.h file and you can use dirent just as in UNIX once you haved copied the file.
The installation package also contains a few example programs and Visual Studio 2008 project file to get you started.

For more information on using dirent, please see Open Group.
附件
dirent.h_for_VS_Compiler.zip
(22.12 KiB) 下载 20 次
dirent.h_for_VS_Compiler.zip
(22.12 KiB) 下载 20 次


回到 “文件与系统”

在线用户

用户浏览此论坛: 没有注册用户 和 1 访客