I'm trying to build bindings for Horde for Go (
http://golang.org/). It looks like it should be fairly straightforward, as Horde's API is C, and you can call C code fairly easily from Go (
http://golang.org/cmd/cgo/).
When trying to build my code, I'm getting these errors, which seem to point to something in the Go compiler not liking how Horde3D.h is written.
Code:
/usr/local/include/horde3d/Horde3D.h:127:7: error: nested redefinition of âenum Listâ
3 /usr/local/include/horde3d/Horde3D.h:127:7: error: redeclaration of âenum Listâ
4 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
5 /usr/local/include/horde3d/Horde3D.h:161:7: error: nested redefinition of âenum Listâ
6 /usr/local/include/horde3d/Horde3D.h:161:7: error: redeclaration of âenum Listâ
7 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
8 /usr/local/include/horde3d/Horde3D.h:216:7: error: nested redefinition of âenum Listâ
9 /usr/local/include/horde3d/Horde3D.h:216:7: error: redeclaration of âenum Listâ
10 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
11 /usr/local/include/horde3d/Horde3D.h:244:7: error: nested redefinition of âenum Listâ
12 /usr/local/include/horde3d/Horde3D.h:244:7: error: redeclaration of âenum Listâ
13 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
14 /usr/local/include/horde3d/Horde3D.h:265:7: error: nested redefinition of âenum Listâ
15 /usr/local/include/horde3d/Horde3D.h:265:7: error: redeclaration of âenum Listâ
16 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
17 /usr/local/include/horde3d/Horde3D.h:288:7: error: nested redefinition of âenum Listâ
18 /usr/local/include/horde3d/Horde3D.h:288:7: error: redeclaration of âenum Listâ
19 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
20 /usr/local/include/horde3d/Horde3D.h:317:7: error: nested redefinition of âenum Listâ
21 /usr/local/include/horde3d/Horde3D.h:317:7: error: redeclaration of âenum Listâ
22 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
23 /usr/local/include/horde3d/Horde3D.h:320:3: error: redeclaration of enumerator âSamplerElemâ
24 /usr/local/include/horde3d/Horde3D.h:291:3: note: previous definition of âSamplerElemâ was here
25 /usr/local/include/horde3d/Horde3D.h:321:3: error: redeclaration of enumerator âUniformElemâ
26 /usr/local/include/horde3d/Horde3D.h:292:3: note: previous definition of âUniformElemâ was here
27 /usr/local/include/horde3d/Horde3D.h:323:3: error: redeclaration of enumerator âSampNameStrâ
28 /usr/local/include/horde3d/Horde3D.h:296:3: note: previous definition of âSampNameStrâ was here
29 /usr/local/include/horde3d/Horde3D.h:324:3: error: redeclaration of enumerator âUnifNameStrâ
30 /usr/local/include/horde3d/Horde3D.h:298:3: note: previous definition of âUnifNameStrâ was here
31 /usr/local/include/horde3d/Horde3D.h:349:7: error: nested redefinition of âenum Listâ
32 /usr/local/include/horde3d/Horde3D.h:349:7: error: redeclaration of âenum Listâ
33 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
34 /usr/local/include/horde3d/Horde3D.h:380:7: error: nested redefinition of âenum Listâ
35 /usr/local/include/horde3d/Horde3D.h:380:7: error: redeclaration of âenum Listâ
36 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
37 /usr/local/include/horde3d/Horde3D.h:408:7: error: nested redefinition of âenum Listâ
38 /usr/local/include/horde3d/Horde3D.h:408:7: error: redeclaration of âenum Listâ
39 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
40 /usr/local/include/horde3d/Horde3D.h:431:7: error: nested redefinition of âenum Listâ
41 /usr/local/include/horde3d/Horde3D.h:431:7: error: redeclaration of âenum Listâ
42 /usr/local/include/horde3d/Horde3D.h:89:7: note: originally defined here
43 /usr/local/include/horde3d/Horde3D.h:433:3: error: redeclaration of enumerator âUndefinedâ
44 /usr/local/include/horde3d/Horde3D.h:163:3: note: previous definition of âUndefinedâ was here
45 /usr/local/include/horde3d/Horde3D.h:455:7: error: nested redefinition of âenum Listâ
46 /usr/local/include/horde3d/Horde3D.h:455:7: error: redeclaration of âenum Listâ
It doesn't seem to like the multiple nested enum definition of List. Am I missing something obvious to you guys?
Here's how I have the initial go declaration:
Code:
package horde3d
/*
#cgo LDFLAGS: -llibHorde3D
#include <horde3d/Horde3D.h>
*/
import "C"
/*
func H3dInit() bool {
return bool(C.h3dInit())
}
*/
Basically anything in that first comment can be valid C code, so as long as the header file is valid C, it should compile fine.