简体   繁体   中英

OpenGL SuperBible 6 first example error

I am trying to write and run the first example in the book "OpenGL SuperBible 6th edition", but I can't get it to work. I get the error:

fatal error C1083: No se puede abrir el archivo incluir: 'sb6.h':
No such file or directory

I am using Visual C++ 2010 Express so I tried fixing this by including as an external resource the folder include where the sb6.h file is located adding "sb6/include" to:

Project | Properties | VC++ folders | Include files folders

But that didn't work and now the error is:

\include\sb6.h(69): fatal error C1083:
No se puede abrir el archivo incluir: 'glfw.h':
No such file or directory

I tried solving this by adding the folder include/GL in the same way that the folder include , but the same error message is thrown.

Just in case you need it, this is my code:

#include <sb6.h>

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

DECLARE_MAIN(my_application);

After trying a lot of things, I went to the working examples' configuration and looked for differences to my configurations. I ended up modifying 3 things:

1.Project | Properties | VC++ Directories | Include Directories
Added two folders: sb6/include and sb6\\extern\\glfw-2.7.6\\include .

2.Project | Properties | VC++ Directories | Library Directories
Added one folder: sb6/lib .

3.Project | Properties | C/C++ | Preprocesor | Preprocesor Definitions
Added three definitions:

WIN32
NDEBUG
_WINDOWS

sb6 folder being the folder where examples are.

After this, I am able to run my_application (from the question post) in Release and Debug mode. Even so, it throws a lot of messages in debug output: Debug output.(pastebin.com) maybe someone knows how to avoid this?

You need to get the GLFW library too and add its include and library paths to your project, and link with its library.

The older versions of GLFW (pre-3) is source and binary forms are available from Sourceforge .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM