[英]FLTK on Visual Studio 2019 x64, "Cannot open include file: 'dirent.h': No such file or directory
I am using the FLTK library in Visual Studio Community 2019 and building my application for x86 works fine.我在 Visual Studio Community 2019 中使用 FLTK 库并为 x86 构建我的应用程序工作正常。 Now, I would like to build it for x64.现在,我想为 x64 构建它。 However, I am getting the error "Cannot open include file: 'dirent.h': No such file or directory.".但是,我收到错误“无法打开包含文件:'dirent.h':没有这样的文件或目录。”。
The error occurs in the file, named 'filename.H'.错误发生在名为“filename.H”的文件中。 This header file comes with the FLTK library.这个 header 文件随 FLTK 库一起提供。
Has anyone an idea how I could fix this problem?有谁知道我该如何解决这个问题?
Update:更新:
The dirent.h library is not recognized, because its an C POSIX library, as described in the link here below.无法识别 dirent.h 库,因为它是一个 C POSIX 库,如下面的链接中所述。 However, the question still remains, namely, how can I fix this problem?但是,问题仍然存在,即我该如何解决这个问题?
<dirent.h> in visual studio 2010 or 2008 <dirent.h> 在 Visual Studio 2010 或 2008 中
The link above refers to a link with an alternative dirent.h file.上面的链接是指带有替代 dirent.h 文件的链接。 I've tried to include this file in my project, however, now another errors occur.我试图将此文件包含在我的项目中,但是,现在又发生了另一个错误。 These errors occur in the file Fl_Native_File_Chooser.H.这些错误发生在文件 Fl_Native_File_Chooser.H 中。 The type specifiers fl_OPENFILENAMEW and fl_BROWSEINFOW are unknown in this file.此文件中的类型说明符 fl_OPENFILENAMEW 和 fl_BROWSEINFOW 未知。
On Windows, dirent.h should not be included in the FLTK code.在 Windows 上,dirent.h 不应包含在 FLTK 代码中。 Even though it is 64 bit, WIN32 must be defined when using the FLTK libraries ( https://www.fltk.org/doc-1.3/preface.html ).即使是 64 位,使用 FLTK 库时也必须定义 WIN32( https://www.fltk.org/doc-1.3/preface.html )。 Your problem will probably be solved if you define WIN32 at the beginning of your code or if you add WIN32 in your Visual Studio project properties - C/C++ - Preprocessor - Preprocessor Definitions, in x64 platform.如果您在代码开头定义 WIN32 或在 x64 平台中的 Visual Studio 项目属性 - C/C++ - 预处理器 - 预处理器定义中添加 WIN32,您的问题可能会得到解决。
The way I would create an x64 solution is我创建 x64 解决方案的方式是
You shouldn't get any dirent.h errors.你不应该得到任何 dirent.h 错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.