简体   繁体   中英

Initializing Glew - Linker error in Visual Studio 2012

I keep getting a linker error trying to get GLEW to work in 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. Both are saved in my glew library folder. I added glew32.lib to Linker:Input:Additional Dependencies. I added the glew32 DLL (glew\\lib) folder added to the system path, and restarted after doing so.

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. 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. 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

IDE: Microsoft Visual Studio 2012 4.5.50709

GLEW: Version 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. So instead, I tried downloading the 32-bit version and it works now. However, I am still confused why it didn't work with the 64-bit version, and how to get it working? It seems that nothing works when you try the 64-bit version!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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