Hi, I got the OpenGL superbible, but I can't get the first code they give to run. Here it is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// Include the "sb6.h" header file
#include "sb6.h"
// Derive my _ application from sb6::application
class my_application : public sb6::application
{
public:
// Our rendering function
void render(double currentTime)
{
// Simply clear the window with red
staticconst GLfloat red[] = { 1.0f, 0.0f, 0.0f, 1.0f };
glClearBufferfv(GL_COLOR, 0, red);
}
};
// Our one and only instance of DECLARE_MAIN
DECLARE _ MAIN(my_application);
My errors are
1 2 3 4 5 6 7
Error 1 error C1083: Cannot open include file: 'sb6.h': No such file or directory c:\users\saam2_000\documents\visual studio 2013\projects\project2\project2\source.cpp 2 1 Project2
2 IntelliSense: cannot open source file "sb6.h" c:\Users\saam2_000\Documents\Visual Studio 2013\Projects\Project2\Project2\Source.cpp 2 1 Project2
3 IntelliSense: name followed by '::' must be a class or namespace name c:\Users\saam2_000\Documents\Visual Studio 2013\Projects\Project2\Project2\Source.cpp 4 31 Project2
4 IntelliSense: identifier "GLfloat" is undefined c:\Users\saam2_000\Documents\Visual Studio 2013\Projects\Project2\Project2\Source.cpp 11 16 Project2
5 IntelliSense: identifier "glClearBufferfv" is undefined c:\Users\saam2_000\Documents\Visual Studio 2013\Projects\Project2\Project2\Source.cpp 12 3 Project2
6 IntelliSense: identifier "GL_COLOR" is undefined c:\Users\saam2_000\Documents\Visual Studio 2013\Projects\Project2\Project2\Source.cpp 12 19 Project2
7 IntelliSense: explicit type is missing ('int' assumed) c:\Users\saam2_000\Documents\Visual Studio 2013\Projects\Project2\Project2\Source.cpp 16 1 Project2
From the output you're getting, it looks like you're using Visual Studio. Putting an existing file in your project in Visual Studio only creates a link to that project on the file system - it doesn't copy the file anywhere. As a result, you are trying to #include "sb6.h", but "sb6.h" doesn't exist in any directory this project knows about.
You have two options.
1. Delete the sb6.h link you added to your VS project, find sb6.h on your file system and manually copy it into the appropriate directory, and then re-add a link to the one you manually copied.
2. THE BETTER OPTION: Add the directory where sb6.h is to your C++ Include Directories in your project settings. (https://msdn.microsoft.com/en-us/library/ee855621.aspx)