我正在尝试在 Windows7 计算机上安装(“go get...”)opengl (https://github.com/go-gl/gl)。我安装了 32 位 Go。下载 32 位 glew .lib .dll 和 .h 文件。我修改了路径环境变量以指向这些glew 文件。我安装了 cygwin 和 mingw。我还安装了 git 和 Mercurial 以使用 go get 命令。我还根据需要设置了 GOPATH 和 GOROOT。
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.
现在有人知道 glew dll 和 .h 文件应该放在 Windows 上的哪里才能使用 go get 进行编译吗?
最佳答案
在 MinGW 安装位置,可能存在名为 include
、lib
和 bin
的文件夹。您需要将 glew.h
放在 include\GL\glew.h
中。如果它们不在 MinGW 下,则它们可能位于您的 Cygwin 安装下的某个位置。
但是,这里有一个技巧。既然您说您有一个 .lib
文件,我假设您下载了预编译的 Windows 二进制文件。你不能这样做,这些是针对 Visual C 并与 Visual Studio 一起使用的。不幸的是,您必须从源代码构建它。这有点挑剔,但应该有资源可以帮助您构建 MinGW 目标。
完成构建后,您应该获得文件 glew32.dll
和 libglew32.dll.a
。它们分别对应于您提到的 .dll
和 .lib
。您需要将 glew32.dll
放在 bin
或 C:\Windows\System32
中(尽管从技术上讲,路径中的任何位置都应该可以工作,但这些是更“标准”的位置)。您需要将 .a
文件放在 lib
目录中。
关于windows - golang opengl Windows 安装问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21638482/