Click here to Skip to main content
15,038,345 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
	void render(double currentTime)
		static const GLfloat red[] = { 1.0f,0.0f,0.0f,1.0f };
	glClearBufferfv(GL_COLOR, 0, red);


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.
Updated 26-Sep-18 7:03am
Richard MacCutchan 29-Sep-15 6:35am
The problem is that the file cannot be found. you should check your installation to see if it has been installed. What platform and IDE are you using?
kozmikadam 29-Sep-15 6:37am
Hi Richard ,

But I'm using Windows. So why it's looking for unistd.h ? I'm using Visual Studio 2015.
Richard MacCutchan 29-Sep-15 6:55am
Something to do with OpenGL I would guess. Take a look inside the sb7.h file.

unistd.h is a unix file.

This post[^] discusses windows alternatives for it.
Stan Huang 30-Mar-16 21:39pm
It works.
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').
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.
Graeme_Grant 23-Sep-17 19:49pm
WHY are you answering a 2-YEAR-OLD question that has ALREADY ACCEPTED an answer. Please don't, instead focus on current question ONLY - there are always plenty waiting for help.
Simply replace the WIN32 written just above the '#include<unistd.h>' with _WIN32
Richard Deeming 26-Sep-18 13:25pm
As already mentioned last year in solution 4.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900