无法打开源文件“unistd.h” [英] cannot open source file "unistd.h"

查看:5798
本文介绍了无法打开源文件“unistd.h”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我刚从OpenGL Superbible v7尝试过第一个样本



这里是代码:



Hello everyone ,

I just tried first sample from OpenGL Superbible v7

and here is the code :

#include "sb7.h"

class  my_application : public sb7::application
{
public:
	void render(double currentTime)
	{
		static const GLfloat red[] = { 1.0f,0.0f,0.0f,1.0f };
	glClearBufferfv(GL_COLOR, 0, red);
}
}

declare_main(my_application);







但这给了我一个错误。



无法打开源文件unistd.h





我的操作系统是Windows 10&我正在使用VS 15





那么问题是什么?



我无法解决这个问题。




but this gives me an error.

cannot open source file "unistd.h"


My OS is Windows 10 & i'm using VS 15


So what is the problem ?

I couldn't solve this.

推荐答案

unistd.h是一个unix文件。



这个发布 [ ^ ]讨论它的windows替代方案。
unistd.h is a unix file.

This post[^] discusses windows alternatives for it.


头文件用于Unix系统。使用Windows时,您可能会尝试注释掉包含它的行。您可能会遇到一些关于缺少函数的错误。然后检查是否在其他Windows特定的头文件中定义了缺少的函数,并包含这些函数( io.h 是候选者)。对于Windows不存在的功能,请检查是否存在类似功能并使用这些功能或仅删除呼叫。但所有这些都要求您理解代码。



或者您可以在网上搜索 unistd.h的Windows端口头文件(搜索术语'unistd.h windows replacement')。
The header file is used on Unix systems. When using Windows, you may try to comment out the lines where it is included. You will probably get some errors then about missing functions. Check then if the missing functions are defined in other Windows specific header files and include those instead (io.h is a candidate). For functions that does not exist with Windows, check if there are similar functions and use those or just remove the calls. But all these requires that you understand the code.

Alternatively you can search the web for a Windows port of the unistd.h header file (search term 'unistd.h windows replacement').


出于当前任务的目的,您可以添加 WIN32 符号预处理器定义(属性页/配置属性/ C / C ++),因此对于调试配置,它将是 _DEBUG; WIN32; _WINDOWS;%(PreprocessorDefinitions)

它对我有用。
For the purpose of current task you can add "WIN32" symbol to PreprocessorDefinitions (Property Pages/Configuration Properties/C/C++), so it would be like this "_DEBUG;WIN32;_WINDOWS;%(PreprocessorDefinitions)" for the debug configuration.
It worked for me.


这篇关于无法打开源文件“unistd.h”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆