简体   繁体   English

OpenGL SuperBible 6第一个例子错误

[英]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. 我正在尝试编写并运行“OpenGL SuperBible第6版”一书中的第一个例子,但我无法让它工作。 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: 我正在使用Visual C ++ 2010 Express,所以我尝试通过包含作为外部资源的文件夹包含 sb6.h文件所在的文件夹,将“sb6 / include”添加到:

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. 我试图通过添加文件夹解决这个包括/ GL以同样的方式,该文件夹包括但同样的错误信息被抛出。

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 | 1.项目| Properties | 属性| VC++ Directories | VC ++目录| Include Directories 包括目录
Added two folders: sb6/include and sb6\\extern\\glfw-2.7.6\\include . 添加了两个文件夹: sb6 / includesb6 \\ extern \\ glfw-2.7.6 \\ include

2.Project | 2.项目| Properties | 属性| VC++ Directories | VC ++目录| Library Directories 图书馆目录
Added one folder: sb6/lib . 添加了一个文件夹: sb6 / lib

3.Project | 3.Project | Properties | 属性| C/C++ | C / C ++ | Preprocesor | 预处理器| Preprocesor Definitions 预处理器定义
Added three definitions: 添加了三个定义:

WIN32
NDEBUG
_WINDOWS

sb6 folder being the folder where examples are. sb6文件夹是示例所在的文件夹。

After this, I am able to run my_application (from the question post) in Release and Debug mode. 在此之后,我能够在Release和Debug模式下运行my_application(来自问题帖子)。 Even so, it throws a lot of messages in debug output: Debug output.(pastebin.com) maybe someone knows how to avoid this? 即便如此,它会在调试输出中抛出大量消息: 调试输出。(pastebin.com)也许有人知道如何避免这种情况?

You need to get the GLFW library too and add its include and library paths to your project, and link with its library. 您还需要获取GLFW库并将其包含和库路径添加到项目中,并链接到其库。

The older versions of GLFW (pre-3) is source and binary forms are available from Sourceforge . 旧版本的GLFW(pre-3)是Sourceforge提供的源代码和二进制形式。

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

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