- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在重新设计一个项目以使用 GLFW 而不是 FreeGLUT,我想我一定设法删除了我的链接器设置中的某些内容。我正在使用 GLEW,虽然我最初认为我已经以某种方式解开了它,但它并没有给我所有与 GLEW 相关的函数调用的错误,只有几个。我已经检查了我使用 git 对属性文件所做的更改,唯一的更改是将 freeglut.lib
替换为 glfwdll.lib
错误信息:
1>main.obj : error LNK2019: unresolved external symbol __imp__glBlendFunc@8 referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glDepthFunc@4 referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function "void __cdecl display(void)" (?display@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _main
1>Renderer.obj : error LNK2019: unresolved external symbol __imp__glBindTexture@8 referenced in function "public: void __thiscall Renderer::Render(unsigned int const &,unsigned int const &,struct RenderVariables const &,unsigned int const &,unsigned int const &)" (?Render@Renderer@@QAEXABI0ABURenderVariables@@00@Z)
1>Sprite.obj : error LNK2001: unresolved external symbol __imp__glBindTexture@8
1>Renderer.obj : error LNK2019: unresolved external symbol __imp__glDrawArrays@12 referenced in function "public: void __thiscall Renderer::Render(unsigned int const &,unsigned int const &,struct RenderVariables const &,unsigned int const &,unsigned int const &)" (?Render@Renderer@@QAEXABI0ABURenderVariables@@00@Z)
1>Sprite.obj : error LNK2019: unresolved external symbol __imp__glGenTextures@8 referenced in function "public: bool __thiscall Sprite::loadSprite(char *)" (?loadSprite@Sprite@@QAE_NPAD@Z)
1>Sprite.obj : error LNK2019: unresolved external symbol __imp__glGetFloatv@8 referenced in function "public: bool __thiscall Sprite::loadSprite(char *)" (?loadSprite@Sprite@@QAE_NPAD@Z)
1>Sprite.obj : error LNK2019: unresolved external symbol __imp__glTexImage2D@36 referenced in function "public: bool __thiscall Sprite::loadSprite(char *)" (?loadSprite@Sprite@@QAE_NPAD@Z)
1>Sprite.obj : error LNK2019: unresolved external symbol __imp__glTexParameterf@12 referenced in function "public: bool __thiscall Sprite::loadSprite(char *)" (?loadSprite@Sprite@@QAE_NPAD@Z)
1>Sprite.obj : error LNK2019: unresolved external symbol __imp__glTexParameteri@12 referenced in function "public: bool __thiscall Sprite::loadSprite(char *)" (?loadSprite@Sprite@@QAE_NPAD@Z)
然后,我的 main() 函数,这是唯一在转换期间最终发生变化的函数:
void main(int argc, char** argv)
{
if (!glfwInit())
{
exit(-1);
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);
GLFWwindow* window = glfwCreateWindow(width, height, "Space Invaders", NULL, NULL);
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
endGame(-1);
}
glfwMakeContextCurrent(window);
glViewport(0, 0, width, height);
// A call to glewInit() must be done after GLFW is initialized!
GLenum res = glewInit();
// Check for any errors
if (res != GLEW_OK) {
fprintf(stderr, "Error: '%s'\n", glewGetErrorString(res));
endGame(1);
}
gameState = new GameState();
init();
while (!glfwWindowShouldClose(window))
{
pollInput(window);
display();
glfwSwapBuffers(window);
glfwPollEvents();
}
endGame(0);
}
我注意到每个抛出错误的函数都有 gl- 前缀而不是 glew-,既然我没有使用 freeglut,我还需要添加另一个库吗?我目前只链接 glfw 和 glew。
最佳答案
好吧,我不确定以前没有它我是如何管理的,但我还需要链接 OpenGL32.lib
。
关于c++ - Glew - 与 GLFW 配对时 gl- 函数符号的链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48492308/
使用glew,我正在尝试链接简单的程序 #include int main (int argc, const char * argv[]) { glewInit(); return
我有一个动态库,在构建中包含glew.c,并使用GLEW_STATIC 构建。如果另一个库链接到同一个应用程序并且还以某种方式包含 GLEW,是否有可能由于单一定义规则而导致 Linux 出现问题?
我在 Macintosh 上使用终端。 要编译的命令是基本的: g++ -c String.cpp -o String.o g++ -c FileIO.cpp -o FileIO.o g++ -c
我正在配置一个与 glut 一起工作的程序来与 Qt 一起工作。我正在使用 Qt 5.1.1。并且似乎从 Qt4 到 Qt5 已经丢失了一些 openGL 功能。在我的程序中,我创建了一个 QOpen
我正在尝试做 openGLbook.com 教程。我收到这个常见错误: 1>------ Build started: Project: OpenGL Startup, Configurati
我读过这个 [1],但在我的例子中,CMake 说它找不到 glew。 我在 Windows 上,我的 CMake 模块文件夹中有一个 FindGLEW.cmake 文件,大概是在我安装 CMake-
这很奇怪。我想在我的 gl 程序中实现着色器。 但 GLEW 告诉我,我的系统不支持着色器: //glut init and glew init ... if (GLEW_ARB_vertex_sha
我想使用三角扇绘制不同的图形,但我不知道如何让程序绘制第二个图形。每次我想更改颜色或绘制新图形时,是否需要第二个 vertexShaderSource 和第二个 fragmentShaderSourc
我现在对尝试链接这个 glew 库感到非常沮丧 这是构建日志: g++ -o test.exe "src\\test.o" -lglew32 -lglfw -lglu32 -lopengl32 src
当我尝试在 CLion 中构建我的项目时,我遇到了来自 cmake 的链接错误。我已经尝试过其他线程所说的:将 opengl 放在最后,将 glu 放在第一位,更改我的 include 的顺序并设置
我遇到了这个问题,不知道该怎么办? 'abc.exe': Loaded 'D:\Windows\SysWOW64\nvoglv32.dll', Cannot find or open the PDB
我只是想使用 SDL 2.0 和 glew 1.9 创建一个 openGL 上下文 构建项目时没有问题,但在调试时,GLEW 初始化失败,我该怎么做才能解决这个问题? 我正在使用 visual stu
我正在使用以下代码检查是否有任何错误: glfwInit(); glewExperimental = GL_TRUE; if (glewInit() != 0) { std::cout <<
不知何故,我无法在多个头文件中获取 Glew。它只是提示 Gl 已经在 GLEW 之前定义了。 简而言之,我有以下文件结构: 程序.h 包括: , 和 "SceneManager.h" . 场景管理器
我的机器有 OpenGL 2.0,由于一些奇怪的原因,头文件 gl.h 不包含着色器函数。所以,有人建议我使用 GLEW。我正确安装了 GLEW,并将 glew32s 链接到我的编译器,我还在我的 m
我需要在 Ubuntu 11.10 中加载扩展。我尝试构建 GLEW,但出现以下奇怪错误... ~/Downloads/glew-1.7.0$ make cc -shared -Wl,-soname=
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我试图通过将源文件添加到我的项目来跳过 glew 的“链接步骤”,以使代码更加灵活(目标 32 位和 64 位,只需稍作修改)。我已经使用 Code::Blocks 和 mingw 32 位实现了 3
出于我无法理解的原因,glew 在静态链接时根本不起作用。有没有一种方法可以简单地将 glew.h、glxew.h、wglew.h 和 glew.c 源文件包含到我的项目中并使用 #include "
我编译了 GLEW 库。它似乎工作正常,这里是 make install 的输出: install -d -m 0755 "/usr/include/GL" install -m 0644 inclu
我是一名优秀的程序员,十分优秀!