LNK2019 glewInit [英] LNK2019 glewInit
问题描述
我的系统版本为1.9.0,我已将所有头文件放在MSVS的include目录中,而所有lib文件都放在了lib文件夹中.然后,我将dll放入sysWOW64文件夹中,并在项目属性下的其他依赖项中添加了所需的所有库:
I have glew version 1.9.0 I have put all the header files in the MSVS include directory and all the lib files in the lib folder. I then put the dll within the sysWOW64 folder and have added all the libs needed in the additional dependencies under the project properties which are:
- opengl32.lib
- glu32.lib
- glut32.lib
- glew32.lib
- glew32mx.lib
- glew32s.lib
- glew32mxs.lib
但是我遇到链接器错误
错误1错误LNK2019:函数_main C:\ Users \ x \ documents \ visual studio 2013 \ Projects \ openGLTest \ openGLTest \ main.obj openGLTest中引用的未解析的外部符号_glewInit @ 0
Error 1 error LNK2019: unresolved external symbol _glewInit@0 referenced in function _main C:\Users\x\documents\visual studio 2013\Projects\openGLTest\openGLTest\main.obj openGLTest
推荐答案
首先,您不应将DLL放入sysWOW64
或任何其他操作系统拥有的目录,例如System32
.就是说,这与您放置DLL的位置以及与链接到(或未链接到)的库的一切都没有关系.
First, you should not place your DLLs into sysWOW64
or any other Operating System owned directory such as System32
. That said, this has nothing to do with where you placed your DLLs and everything to do with the library you linked to (or rather did not link to).
您也不应链接到4种不同的GLEW配置:
You also should not be linking to 4 different GLEW configurations:
- 动态(glew32)
- 动态多上下文(glew32mx)
- 静态(glew32s)
- 静态多上下文(glew32mxs)
链接到的最佳库通常是glew32s.lib
,因为它首先消除了对DLL的需求,但是随后您需要在#include "glew.h"
The best library to link to usually is glew32s.lib
as it negates the need for the DLL in the first place, but then you need to add #define GLEW_STATIC
before you #include "glew.h"
#pragma comment (lib, "glew32s.lib")
#define GLEW_STATIC
#include "glew.h"
这篇关于LNK2019 glewInit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!