无法让 GLEW 与 VS2010 一起工作,链接器错误



我正在尝试学习OpenGL,并使用openglbook.com作为参考。我正试图让GLEW和freeglut在我的电脑上工作,所以我首先要了解他为让他们在这里使用Visual Studio制定的步骤:http://openglbook.com/setting-up-opengl-glew-and-freeglut-in-visual-c.我严格遵循它,唯一的区别是我使用的是Visual Studio 2010 Ultimate。

当我尝试使用GLEW时,问题出现了;当这种情况发生时,我会得到一个链接器错误。以下是错误消息的全文:

1>------ Build started: Project: gl1, Configuration: Debug Win32 ------
1>Build started 2012/07/28 20:12:19.
1>InitializeBuildStatus:
1>  Touching "Debuggl1.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>main.obj : error LNK2019: unresolved external symbol __imp__glewGetErrorString@4 referenced in function _Initialize
1>main.obj : error LNK2019: unresolved external symbol __imp__glewInit@0 referenced in function _Initialize
1>c:usersmagpiedocumentsvisual studio 2010Projectsgl1Debuggl1.exe : fatal error LNK1120: 2 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.84
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

有什么帮助吗?当我第一次遇到这个错误时,我尝试从源代码编译GLEW,但这也没有修复它(假设我做得正确)。

此错误意味着编译器无法找到头文件中描述的方法的实现。要使用应用程序静态编译GLEW,请将glew32.lib文件添加到库搜索目录(项目属性->VC搜索目录)。

最新更新