2012-06-18 67 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。