2015-10-24 37 views
2

我知道,我已经问过这个问题,但它被标记为重复,但没有其他问题回答了我的答案,所以我不得不再次问这个问题,因为我编辑这个问题后,复制标志未被删除。
所以这里是我的问题(再次):GLEW库和代码::块

我有一个Code :: Blocks的问题。
我想尝试一些我已经了解的关于OpenGL的东西,并且因为我想用Code :: Blocks来做到这一点。

但每次我尝试链接库(GLEW)时,我无法编译我的代码。

obj\Debug\source\main.o:main.cpp:(.text+0x97): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0xad): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0xbb): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0xd0): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0xdf): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0xe7): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x103): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x112): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x247): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x439): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x5b8): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x5c6): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x64a): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x65a): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x850): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x893): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x8a8): undefined reference to `[email protected]' 
    obj\Debug\source\main.o:main.cpp:(.text+0x8b0): undefined reference to `[email protected]' 

我包括GL/glew.h和GL/gl.h在我的代码的顶部和链接器设置:
1 ... \ GLEW \ LIB \发布\ 64 \ glew32s的.lib
2. ... \ GLEW \ LIB \发布\ 64 \ glew32.lib

这是Build命令:

mingw32-g++.exe -LE:...\glew-1.13.0\include -o bin\Debug\TestProject.exe obj\Debug\source\main.o ...\glew-1.13.0\lib\Release\x64\glew32s.lib ...\glew-1.13.0\lib\Release\x64\glew32.lib "...\glew-1.13.0\lib\Release MX\x64\glew32mxs.lib" "...\glew-1.13.0\lib\Release MX\x64\glew32mx.lib" 

我尝试了所有的回答前面的问题并没有什么工作对我来说...即使我不使用任何OpenGL函数我得到这个错误。我知道这些错误是什么,并且知道我应该怎么做,如果他们来自我的代码,但我现在不知道该怎么做。
请删除双后记法,因为推荐问题的答案对我没有帮助。

我真的希望你能帮助我。 谢谢。

+1

你链接到opengl32.lib? – BDL

+0

可能重复[什么是未定义的引用/未解析的外部符号错误,以及如何解决它?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external- symbol-error-and-how-do-i-fix) – BDL

+0

下一页:你可以使用glew静态链接或动态链接,但从来没有。 – BDL

回答

0

您是否在包含GL/glew.h之前定义了GLEW_STATIC?也去编译器设置面板,并添加到其他选项-DGLEW_STATIC

确保通过将glew32sopengl32添加到链接器设置,正确链接了库。

+0

谢谢你的回答。 是的,我确定了GLW_STATIC并添加了该选项。 glew32s ist增加,但opengl32?这个文件在哪里? – DMCKITT

+0

opengl32已经存在于你的系统中,你只需要通过在你的链接器设置中加入'opengl32'来链接它。 –

+0

谢谢。我不知道。它现在有效。 即使看起来gcc无法处理Library-Paths中的“ä”... – DMCKITT