2013-05-07 15 views
11

Goプログラム内からOpenGLを使用しようとしています。私はだと思っています。私はすべての作品を用意していますが、まだそれを動かすことはできません。GoからOpenGLを使用する

私のCコンパイラはの変数にあり、cgoのドキュメントの乱数の例で動作することを確認しました。

mingw-w64のインストールで、bin、lib、およびincludeフォルダを\mingw\x86_64-w64-mingw32相当にコピーして、64ビットGLEW 1.9.0をインストールしました。私がしようとgo get github.com/go-gl/glを実行すると

、次のように回答を行く:

In file included from attriblocation.go:7:0: 
gl.h:5:25: error: enumerator value for '__cgo_enum__5' is not an integer constant 
#define GLEW_GET_FUN(x) (*x) 
         ^
d:\programs\mingw64\x86_64-w64-mingw32\include\gl\glew.h:1956:26: note: in expansion of macro 'GLEW_GET_FUN' 
#define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f) 
         ^
gl.h:5:25: error: enumerator value for '__cgo_enum__6' is not an integer constant 
#define GLEW_GET_FUN(x) (*x) 

これらのエラーは__cgo_enum__15までの値について、同様の方法で続けます。私はまた、いくつかの一致エラーは、各エントリのものの行く側から来る得る。

これを機能させるために私が紛失していることに関するアイデアはありますか?

編集:ここでは、物事のGo側からの '一致する'ログがあります。

attriblocation.go:42:2: error: initializer element is not constant 
func (indx AttribLocation) Attrib4fv(values *[4]float32) { 
^
attriblocation.go:42:2: error: (near initialization for '__cgodebug_data[5]') 
attriblocation.go:43:2: error: initializer element is not constant 
    C.glVertexAttrib4fv(C.GLuint(indx), (*C.GLfloat)(&values[0])) 
^
attriblocation.go:43:2: error: (near initialization for '__cgodebug_data[6]') 
attriblocation.go:44:2: error: initializer element is not constant 
} 

__cgodebug_data[] 5-15に1つあります。

編集2:ログを添付するように求められました。 Here is what happens when I compile with GCC 4.8およびHere is what I get with 4.7 and 4.6

+0

マッチングエラーはどういう意味ですか?あなたもそれらを投稿できますか? – nemo

+0

私は家のゴーサイドから来たようなエラーを追加しました。 –

+0

'$ GOROOT/src/pkg/github.com/go-gl/gl'で' go build -a -x'を実行して、既に投稿したエラーメッセージに加えて失敗した行を貼り付けてください。これらは役に立ちます。 – nemo

答えて

3

Goの不具合と、C/Goコンパイラが互いにどのように通信しているかのようです。回避策は、CGO_CFLAGS=-ftrack-macro-expansion=0 go buildと設定することです。また、go-1.2rc5以降を使用して問題を修正することもできます。 This bug has been closed with the previous workarounds/fixes specified

+1

これは実際にはgo-glではなくgoの欠陥です。お互いに話しているコンパイラの問題であるため、問題を解決するためにgo-glが行うことはできません。 – pwaller

+0

あなたは正しいです!回答が明確になるように編集しました。 –

関連する問題