简体   繁体   English

OpenGL编译问题

[英]OpenGL compiling issues

I am using Visual Studio C++ and GLEW. 我正在使用Visual Studio C ++和GLEW。 The Project Settings are all set (Includes/Libs). 项目设置全部设置(包括/ Libs)。

MenuState.obj : error LNK2001: unresolved external symbol __imp____glewUseProgramObjectARB
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewLinkProgramARB
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewAttachObjectARB
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewCompileShader
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewShaderSource
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewCreateShader
MenuState.obj : error LNK2001: unresolved external symbol __imp____glewCreateProgramObjectARB

These are the only Messages I get. 这些是我收到的唯一消息。 Everything worked fine until I tried to implement a Shader. 一切正常,直到我试图实现着色器。 The Problem is I am working within a VM, so my question is: Does GLEW need opengl32.lib as a dependency? 问题是我在虚拟机中工作,所以我的问题是:GLEW是否需要将opengl32.lib作为依赖? Because if I dont add the opengl32.lib to the Linker I get even more errors. 因为如果我不将opengl32.lib添加到链接器,我会得到更多错误。 And if so could the Problem be caused by the opengl32.lib? 如果是这样,问题可能是由opengl32.lib引起的? Because I think the opengl32.lib is the standard windows opengl32.lib, that would mean it's only opengl 1.1, and therefor it can't link... 因为我认为opengl32.lib是标准的windows opengl32.lib,这意味着它只是opengl 1.1,因此无法链接...

So what is the issue about these errors? 那么这些错误的问题是什么?

Make sure to #define GLEW_STATIC in the project before including GLEW in Windows. 在Windows中包含GLEW之前,请确保在项目中#define GLEW_STATIC。 Then you can just include the entire source code in your project files. 然后,您可以在项目文件中包含整个源代码。 Otherwise, you need to have the proper GLEW DLL file in with your executable. 否则,您需要在可执行文件中包含正确的GLEW DLL文件。

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

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