2012-06-18 54 views
1

我要让GLEW与代码块,而他们已经试图让
提交了一份关于site工作的第一个方法。
这是将glew静态编译到可执行文件中的方法。
但我没有设法解决它。
我在PC上运行Windows 7,运行CodeBlocks 10.05。设置GLEW +代码块

这是我迄今所做的:

  • 下载GLEW 1.7.0
  • 已解压到C:
  • 创建空项目中的代码块
  • 感动glew.h,wglew。 h和glew.c放到我的项目源目录中
  • 将三个文件全部添加到项目中
  • 在glew.cf中更改了include路径或glew.h和wglew.h从

    #include <GL/glew.h> 
    #include <GL/wglew.h> 
    

    #include "glew.h" 
    #include "wglew.h" 
    
  • 创建了一个简单的主文件,下面的代码

    #define GLEW_STATIC 
    #include "glew.h" 
    
    int main() { 
        glewInit(); 
        return 0; 
    } 
    

而与此编译将导致大量的警告 和错误。

  • 错误,如:

    glew.c|2933|undefined reference to `[email protected]'| 
    glew.c|2934|undefined reference to `[email protected]'| 
    glew.c|2935|undefined reference to `[email protected]'| 
    glew.c|2936|undefined reference to `[email protected]'| 
    
  • 警告如:

    glew.c|10050|warning: '__wglewReleaseVideoCaptureDeviceNV' redeclared without dllimport attribute: previous dllimport ignored| 
    glew.c|10052|warning: '__wglewBindVideoImageNV' redeclared without dllimport attribute: previous dllimport ignored| 
    glew.c|10053|warning: '__wglewGetVideoDeviceNV' redeclared without dllimport attribute: previous dllimport ignored| 
    glew.c|10054|warning: '__wglewGetVideoInfoNV' redeclared without dllimport attribute: previous dllimport ignored| 
    glew.c|10055|warning: '__wglewReleaseVideoDeviceNV' redeclared without dllimport attribute: previous dllimport ignored| 
    

哪儿我去错了吗?
如果有必要,我很乐意分享更多信息!

回答

4

你可以通过链接你的程序opengl32和那些警告定义GLEW_STATIC在glew.c之前#include s消除这些错误。

在任何情况下,您的程序都不能工作,因为在使用glewInit之前,您需要拥有有效的OpenGL上下文。你需要创建一个glut/glfw/SDL/wglCreateContext/etc。