GLEW和CodeBlocks的链接器问题

时间:2012-08-03 02:30:15

标签: opengl linker sdl codeblocks glew

我正在尝试使用Code :: Blocks。我正在使用OpenGL和SDL。根据我的阅读,我遇到了根据我的错误链接的问题。(见下文)以下是我在CB中建立链接的方式

enter image description here

错误

-------------- Build: Debug in ColdFusion ---------------

Linking executable: bin\Debug\ColdFusion.exe
Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_GL_VERSION_1_2]+0x4): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_GL_VERSION_1_3]+0x4): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_GL_VERSION_1_4]+0x4): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_GL_VERSION_1_5]+0x4): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_GL_VERSION_2_0]+0x4): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_GL_VERSION_2_1]+0x4): more undefined references to `_imp__wglGetProcAddress@4' follow
lib\glew32s.lib(./static/release/glew.obj):(.text[_glewGetExtension@4]+0xa): undefined reference to `_imp__glGetString@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[_glewContextInit@0]+0x4): undefined  reference to `_imp__glGetString@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_WGL_3DL_stereo_control]+0x7): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_WGL_AMD_gpu_association]+0x4): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_WGL_ARB_buffer_region]+0x4): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_WGL_ARB_create_context]+0x7): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_WGL_ARB_extensions_string]+0x7): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[__glewInit_WGL_ARB_make_current_read]+0x4): more undefined references to `_imp__wglGetProcAddress@4' follow
lib\glew32s.lib(./static/release/glew.obj):(.text[_wglewGetExtension@4]+0x21): undefined reference to `_imp__wglGetCurrentDC@0'
lib\glew32s.lib(./static/release/glew.obj):(.text[_wglewContextInit@0]+0x4): undefined reference to `_imp__wglGetProcAddress@4'
lib\glew32s.lib(./static/release/glew.obj):(.text[_wglewContextInit@0]+0x3e): undefined reference to `_imp__wglGetCurrentDC@0'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 5 seconds)
15 errors, 1 warnings

1 个答案:

答案 0 :(得分:2)

虽然我不知道Code :: Blocks如何处理库及其顺序,但我知道顺序很重要。您需要放置依赖之前的库它所依赖的库。

因此,如果其中一个SDL库依赖于glew库中的函数,则glew库应该列表中的SDL库之后。