doufu6423
doufu6423
2014-02-07 21:54

golang opengl Windows安装问题

已采纳

I'm trying to install ("go get...") opengl (https://github.com/go-gl/gl) on a Windows7 machine . I have 32 bit Go installed. 32 bit glew .lib .dll and .h files downloaded. I modified the path environment variable to point to these glew files. I have cygwin along with mingw installed. I also have git and mercurial installed for the use of go get command. I also have my GOPATH and GOROOT set as appropriate.

PS C:\Users\peterpan> go get github.com/go-gl/gl
# github.com/go-gl/gl
In file included from C:\cygwin\home\peterpan\GoProjects\src\github.com\go-gl\gl\attriblocation.go:7:0:
gl.h:2:21: fatal error: GL/glew.h: No such file or directory
#include <GL/glew.h>
                 ^
compilation terminated.

Now does anyone know where the glew dll and .h files are supposed to go on windows to make compilation work with go get?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • doupin5667 doupin5667 7年前

    In the location of your MinGW install, there are likely folders called include, lib, and bin. You'll want glew.h in include\GL\glew.h. If they're not under MinGW they're likely somewhere under your Cygwin install.

    However, there's a trick here. Since you say you have a .lib file, I'm going to assume you downloaded the precompiled Windows binaries. You can't do this, those are for Visual C and use with Visual Studio. You're, unfortunately, going to have to build it from source. It's a bit finicky, but there should be resources to help you build to a MinGW target.

    After you finish building it, you should get the files glew32.dll and libglew32.dll.a. These correspond to the .dll and the .lib you mentioned, respectively. You'll want glew32.dll in either bin or C:\Windows\System32 (though technically anywhere in your Path should work, those are the more "standard" locations). You'll want the .a file in the lib directory.

    点赞 评论 复制链接分享