首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >LNK2019 glewInit

LNK2019 glewInit
EN

Stack Overflow用户
提问于 2014-06-12 02:03:43
回答 2查看 6.3K关注 0票数 0

我有glew版本1.9.0,我已经将所有头文件放在MSVS包含目录中,所有lib文件放在lib文件夹中。然后,我将dll放入sysWOW64文件夹中,并在项目属性下的附加依赖项中添加了所需的所有库:

  • opengl32.lib
  • glu32.lib
  • glut32.lib
  • glew32.lib
  • glew32mx.lib
  • glew32s.lib
  • glew32mxs.lib

但是,我得到了一个链接错误。

错误1错误LNK2019:函数_main C中引用的未解析外部符号_glewInit@0:\_main\x\文档\visual studio 2013\Projects\openGLTest\openGLTest\main.obj openGLTest

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-06-12 02:13:50

首先,不应将DLL放置到sysWOW64或任何其他操作系统拥有的目录(如System32 )中。也就是说,这与您放置DLL的位置无关,与链接到的库(或者更确切地说没有链接到)有关。

您也不应该链接到4种不同的GLEW配置:

  1. 动态(glew32)
  2. 动态多上下文(glew32mx)
  3. 静态(glew32s)
  4. 静态多上下文(glew32mxs)

链接到的最佳库通常是glew32s.lib,因为它首先否定了DLL的需要,但随后需要在#include "glew.h"之前添加DLL。

在MSVC中,您可以将以下内容添加到源文件中,以便同时处理所有这些事情的:

代码语言:javascript
复制
#pragma comment (lib, "glew32s.lib")
#define GLEW_STATIC
#include "glew.h"
票数 2
EN

Stack Overflow用户

发布于 2016-12-06 05:29:24

我找到了这个问题的解决方案,这里

  • 包括头文件:
代码语言:javascript
复制
1. Right click on your `project > Properties > Configuration > C/C++ > General > Additional Include Directories`
2. On the right dropdown, click `<Edit...>`
3. `Additional Inclue Directories` has appeared
4. Click the `new line icon > browse button`  then select the glew include folder: `$(your path to glew)\glew-1.12.0\include`
  • 包括图书馆
代码语言:javascript
复制
1. Right click on your project `> Properties > Configuratio Properties > Linker > General > Additional Library Directories`
2. Click `<Edit...>`
3. `Additional Library Directories` has appeared
4. **For the 64-bit version**: add `$(your path to glew)\glew-1.12.0\lib\Release\x64`
5. **For 32-bit version**: add `$(your path to glew)\glew-1.12.0\lib\Release\Win32`
6. Right click on your project (again) `>Properties > Configuration Properties > Linker > Input > Additional Dependencies`
7. Click `<Edit..>`
8. `Additional Dependencies` window has appeared
9. Click the white area and write `glew32.lib`
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24175420

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档