【发布时间】:2014-05-04 16:37:38
【问题描述】:
我想使用 OpenGL 和 C++ 来创建一个带有“相机”(透视)和要查看的对象的基本场景。我找到了一个示例代码here。但出于某种原因,尽管我已经将所有必要的包含和库绑定在一起(见下文),
// OpenGL init and components:
#include <glload/gl_3_3.h>
#include <glload/gl_load.hpp>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/freeglut.h>
#include <excpt.h>
#include <glm/glm.hpp>
IDE(Visual Studio Express 2012 for Windows Desktop)不同意我的观点:
如果您需要某种特定类型的更多信息,请告诉我。
================================================ ===============================
更新:在摆弄了一些与 opengl 相关的文件之后,这就是我想出的:
// Basics:
#include <windows.h>
#include <string>
#include <exception>
#include <stdexcept>
#include <stdio.h>
#include <stdlib.h>
// OpenGL init and components:
#include <glload/gl_3_1_comp.h>
#include <glload/gl_3_2_comp.h>
#include <glload/gl_3_3.h>
#include <glload/gl_4_0_comp.h>
#include <glload/gl_4_1_comp.h>
#include <glload/gl_4_2_comp.h>
#include <glload/gl_4_3_comp.h>
#include <glload/gl_4_4_comp.h>
#include <glload/gl_load.hpp>
#include <GL/glew.h>
#include <GL/freeglut.h>
#include <excpt.h>
#include <glm/glm.hpp>
它告诉我 GLEW_OK 是未定义的,尽管它就在 glew.h 中:
#define GLEW_OK 0
【问题讨论】:
-
您不应该真正将 glload 的标头与旧的 GL/gl.h 标头混合使用。目前还不清楚您要针对什么,但现代核心 GL 没有像
glMatrix()这样的功能。如果你想要这些东西,你可能应该包含头文件。你不应该太在意智能感知告诉你什么;它很容易混淆。代码可以编译吗? -
@derhass:太好了。现在我想出了一堆链接器错误,第一个是
Error 1 error LNK2001: unresolved external symbol __funcptr_glClear C:\Users\Andrey\documents\visual studio 2012\Projects\gameLab02\gameLab02\main.obj gameLab02