简体   繁体   English

初始化Glew-Visual Studio 2012中的链接器错误

[英]Initializing Glew - Linker error in Visual Studio 2012

I keep getting a linker error trying to get GLEW to work in VS2012. 我一直在尝试使GLEW在VS2012中工作时出现链接器错误。 I have searched online, and none of the solutions worked. 我已经在网上搜索,但没有解决方案。

To set up, I added glew\\include to VC++ Include Directories, and glew\\lib to VC++ Library Directories. 要进行设置,我将glew\\include添加到VC ++包含目录,并将glew\\lib到VC ++库目录。 Both are saved in my glew library folder. 两者都保存在我的glew库文件夹中。 I added glew32.lib to Linker:Input:Additional Dependencies. 我将glew32.lib添加到Linker:Input:Additional Dependencies。 I added the glew32 DLL (glew\\lib) folder added to the system path, and restarted after doing so. 我将glew32 DLL(glew \\ lib)文件夹添加到了系统路径,并在这样做后重新启动。

Prior to this, I tried by adding the include and lib files directly into the Visual Studio install directory where it searches for them by default, with the .dll placed in System32. 在此之前,我尝试通过将include和lib文件直接添加到Visual Studio安装目录中(默认情况下,该目录在其中搜索.dll)将它们添加到System32中。 This solution also failed to work. 此解决方案也无法正常工作。

My code goes as follows: 我的代码如下:

#pragma comment(lib, "glew32.lib")

#include <GL/glew.h>

int main(){
    glewInit();
}

That's it. 而已。 The code fails the same regardless where I put the #pragma , or even when I remove it completely. 无论我将#pragma放在哪里,甚至完全删除它,代码都一样失败。 This gets the following error: 这将出现以下错误:

main.obj : error LNK2019: unresolved external symbol __imp__glewInit@0 referenced in function _main

OS: Windows 7 Ultimate 64-bit 操作系统:Windows 7 Ultimate 64-bit

IDE: Microsoft Visual Studio 2012 4.5.50709 IDE:Microsoft Visual Studio 2012 4.5.50709

GLEW: Version 1.9.0 GLEW:版本1.9.0

EDIT: Right after posting this, I tried re-downloading the GLEW .zip file, and realized that I downloaded the 64-bit version. 编辑:发布此消息后,我立即尝试重新下载GLEW .zip文件,并意识到我下载了64位版本。 So instead, I tried downloading the 32-bit version and it works now. 因此,我尝试下载32位版本,现在可以使用了。 However, I am still confused why it didn't work with the 64-bit version, and how to get it working? 但是,我仍然感到困惑,为什么它不能与64位版本一起使用,以及如何使其工作? It seems that nothing works when you try the 64-bit version! 尝试使用64位版本时,似乎没有任何效果!

您是否正在设置VS以在属性页上构建64Bit?

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

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