简体   繁体   English

GLEW库和代码::块

[英]GLEW Library and Code::Blocks

I know, i already asked this question but it was tagged as duplicate but no other Question was answered with a answer that worked for me, so i have to ask this question again, beacuse the duplicate flag was not removed after i edited this question. 我知道,我已经问过这个问题,但是它被标记为重复,但是没有其他问题得到了对我有用的答案,所以我不得不再次问这个问题,因为在编辑此问题后没有删除重复标记。
So here is my question (again): 所以这是我的问题(再次):

i have a problem with Code::Blocks. 我对Code :: Blocks有问题。
I want to try out some stuff i have learned about OpenGL and because of reasons i want to do it with Code::Blocks. 我想尝试一些有关OpenGL的知识,并且由于某些原因我想使用Code :: Blocks来做。

But every time i try to link the library (GLEW), i cannot compile my code. 但是每次我尝试链接库(GLEW)时,我都无法编译我的代码。

    obj\Debug\source\main.o:main.cpp:(.text+0x97): undefined reference to `ChoosePixelFormat@8'
    obj\Debug\source\main.o:main.cpp:(.text+0xad): undefined reference to `SetPixelFormat@12'
    obj\Debug\source\main.o:main.cpp:(.text+0xbb): undefined reference to `wglCreateContext@4'
    obj\Debug\source\main.o:main.cpp:(.text+0xd0): undefined reference to `wglMakeCurrent@8'
    obj\Debug\source\main.o:main.cpp:(.text+0xdf): undefined reference to `glMatrixMode@4'
    obj\Debug\source\main.o:main.cpp:(.text+0xe7): undefined reference to `glLoadIdentity@0'
    obj\Debug\source\main.o:main.cpp:(.text+0x103): undefined reference to `gluOrtho2D@32'
    obj\Debug\source\main.o:main.cpp:(.text+0x112): undefined reference to `glMatrixMode@4'
    obj\Debug\source\main.o:main.cpp:(.text+0x247): undefined reference to `GetStockObject@4'
    obj\Debug\source\main.o:main.cpp:(.text+0x439): undefined reference to `GetStockObject@4'
    obj\Debug\source\main.o:main.cpp:(.text+0x5b8): undefined reference to `wglMakeCurrent@8'
    obj\Debug\source\main.o:main.cpp:(.text+0x5c6): undefined reference to `wglDeleteContext@4'
    obj\Debug\source\main.o:main.cpp:(.text+0x64a): undefined reference to `wglMakeCurrent@8'
    obj\Debug\source\main.o:main.cpp:(.text+0x65a): undefined reference to `wglDeleteContext@4'
    obj\Debug\source\main.o:main.cpp:(.text+0x850): undefined reference to `glBegin@4'
    obj\Debug\source\main.o:main.cpp:(.text+0x893): undefined reference to `glColor3ub@12'
    obj\Debug\source\main.o:main.cpp:(.text+0x8a8): undefined reference to `glVertex2d@16'
    obj\Debug\source\main.o:main.cpp:(.text+0x8b0): undefined reference to `glEnd@0'

I included GL/glew.h and GL/gl.h on the top of my code and the linker-settings are: 我在代码顶部包括了GL / glew.h和GL / gl.h,链接器设置为:
1. ...\\glew\\lib\\Release\\x64\\glew32s.lib 1. ... \\ glew \\ lib \\ Release \\ x64 \\ glew32s.lib
2. ...\\glew\\lib\\Release\\x64\\glew32.lib 2. ... \\ glew \\ lib \\ Release \\ x64 \\ glew32.lib

This was the Build command: 这是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"

I tried all answers to previous questions and nothing worked for me... Even if i dont use any OpenGL Function i get this errors. 我尝试了所有先前问题的答案,但对我没有任何帮助...即使我不使用任何OpenGL函数,也会出现此错误。 I know what these Errors are and would know what i should do if they would come from me code, but i dont know what to do now. 我知道这些错误是什么,并且如果它们来自我的代码,我会知道该怎么办,但是我现在不知道该怎么办。
Please remove the double-post-notation because the answers to the recommend question are not helpful for me. 请删除双引号,因为推荐问题的答案对我没有帮助。

I really hope you can help me. 我真的希望你能帮助我。 Thank you. 谢谢。

Did you defined GLEW_STATIC before including GL/glew.h ? GLEW_STATIC在包含GL/glew.h之前定义了GL/glew.h Also go to compiler settings panel, and to other options add -DGLEW_STATIC . 也可以转到编译器设置面板,并在其他选项中添加-DGLEW_STATIC

Make sure you linked the lib correctly by adding glew32s and opengl32 to the linker settings. 通过将glew32sopengl32添加到链接器设置,确保正确链接了lib。

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

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