this code runs well on ubuntu gcc --version
gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
but build fail on mac

 gcc --version

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/usr/include/c++/4.2.1

Apple LLVM version 8.0.0 (clang-800.0.42.1)

Target: x86_64-apple-darwin15.5.0

Thread model: posix

any workaround ?


在 2017年4月26日星期三 UTC+8下午3:59:15,hui zhang写道:
>
> I simply the case  as below , how to fix it?
>
> package main
>
> /*
> #include <stdlib.h>
> #include <stdio.h>
> typedef void GLvoid;
> GLvoid Foo() {
>    printf("foo");
> }
> */
> import "C"
>
> func main() {
>    C.Foo()
> }
>
> go build void.go
>
> cgo-gcc-prolog:34:10: error: field has incomplete type 'GLvoid' (aka 
> 'void')
> 在 2017年4月26日星期三 UTC+8下午3:20:14,hui zhang写道:
>>
>> Check code below
>> go call c opengl/opengles code,   typedef void GLvoid
>>
>> func GenVertexArrays(n int32, arrays *uint32) {
>>    //C.glGenVertexArrays((C.GLsizei)(n), 
>> (*C.GLuint)(unsafe.Pointer(arrays)))      --> ok on darwin amd64
>>    C.glGenVertexArraysOES((C.GLsizei)(n), 
>> (*C.GLuint)(unsafe.Pointer(arrays)))     --> fail on darwin arm
>> }
>>
>> Error Message
>>
>> cgo-gcc-prolog:36:10: error: field has incomplete type 'GLvoid' (aka 
>> 'void')
>> For the GLvoid(aka void)  can not be understood by cgo
>>
>> function decalred
>> void *glGenVertexArrays*(GLsizei n, GLuint *arrays); -->on darwin amd64 
>> opengl
>>
>> GLvoid glGenVertexArraysOES(GLsizei n, GLuint *arrays) -->on darwin arm 
>> opengles
>>
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to