简体   繁体   English

无法打开包含文件:“unistd.h”:没有这样的文件或目录

[英]Cannot open include file: 'unistd.h': No such file or directory

After having installed libpng into my computer, I've included it into my project using #include <png.h> on a Windows 7 SP1 plateform and using Visual Studio Ultimate 2013.libpng安装到我的计算机后,我在 Windows 7 SP1 平台上使用#include <png.h>并使用 Visual Studio Ultimate 2013 将其包含到我的项目中。

But at build time, I'm getting this error:但是在构建时,我收到了这个错误:

C1083: Cannot open include file: 'unistd.h': No such file or directory C1083: 无法打开包含文件: 'unistd.h': 没有那个文件或目录

How do I please to fix this?我该如何解决这个问题? I haven't found yet any solution in the.net?我还没有在 .net 中找到任何解决方案?

The "uni" in unistd stands for "UNIX" - you won't find it on a Windows system. unistd中的“ uni”代表“ UNIX”-在Windows系统上找不到。

Most widely used, portable libraries should offer alternative builds or detect the platform and only try to use headers/functions that will be provided, so it's worth checking documentation to see if you've missed some build step - eg perhaps running "make" instead of loading a ".sln" Visual C++ solution file. 使用最广泛的可移植库应该提供替代的构建或检测平台,并且仅尝试使用将提供的标头/函数,因此值得检查文档以查看是否错过了一些构建步骤-例如,也许运行“ make”加载“ .sln” Visual C ++解决方案文件的过程。

If you need to fix it yourself, remove the include and see which functions are actually needed, then try to find a Windows equivalent. 如果您需要自己修复它,请删除包含文件并查看实际需要哪些功能,然后尝试查找等效的Windows。

If you're using ZLib in your project, then you need to find : 如果您在项目中使用ZLib,则需要查找:

#if 1

in zconf.h and replace(uncomment) it with : 在zconf.h中并将其替换(取消注释)为:

#if HAVE_UNISTD_H /* ...the rest of the line

If it isn't ZLib I guess you should find some alternative way to do this. 如果不是ZLib,我想您应该找到其他替代方法。 GL. GL。

Change your C++ standard to C++17 from your project directory.将项目目录中的 C++ 标准更改为C++17 because you do not need to unistd.h in C++17 standard in VS.因为你不需要 unistd.h in C++17 标准在 VS 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 clang ++:致命错误:'unistd.h'文件未找到 - clang++: fatal error: 'unistd.h' file not found unistd.h 中的 pwrite() 未将数据写入 C++ 中的文件 - pwrite() from unistd.h is not writing data to file in C++ Clang 错误 - 致命错误:找不到“unistd.h”文件 - Clang error - fatal error: 'unistd.h' file not found 无法打开包含文件:&#39;graphics.h&#39;:没有这样的文件或目录 - Cannot open include file: 'graphics.h': No such file or directory 无法打开包含文件:&#39;d3dx9.h&#39;:没有这样的文件或目录 - Cannot open include file: 'd3dx9.h': No such file or directory 无法打开包含文件“windows.h”没有这样的文件或目录 - Cannot open include file “windows.h” No such file or directory 无法打开包含文件:&#39;VersionHelpers.h&#39;:没有这样的文件或目录 - Cannot open include file: 'VersionHelpers.h': No such file or directory 无法打开包含文件:&#39;ctype.h&#39;:没有这样的文件或目录 - Cannot open include file: 'ctype.h': No such file or directory 无法打开包含文件 - &#39;gtest.h&#39; - 没有这样的文件或目录 - Cannot open include file - 'gtest.h' - No such file or directory 错误:无法打开包含文件:“MQTTAsync.h”:没有这样的文件或目录 - Error: Cannot open include file: 'MQTTAsync.h': No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM