I just want to add that for mac/osx/darwin, in order to use an external 
framework with cgo and avoid this error you can do the following:

package main

// To import the CoreGraphics.framework
import (
    // #cgo LDFLAGS: -framework CoreGraphics
    // #include <CoreGraphics/CoreGraphics.h>
    "C"
    // other packages...
)

func main() {
    display := C.CGMainDisplayID()
    fmt.Println(display)
    fmt.Println(C.CGDisplayCreateImage(display))
}



On Monday, April 6, 2015 at 6:00:20 PM UTC+3, gofire wrote:
>
>  I am trying to use enet through C with cgo
> package main
>
> import(
> /*
> #include "enet.h"
> */
> "C"
> "fmt"
> )
>
> func main() {
> if C.enet_initialize() != 0 {
> fmt.Println("ok")
> }
> C.enet_deinitialize()
> }
>
> and i got this error
>
> # command-line-arguments
>
> Undefined symbols for architecture x86_64:
>
>   "_enet_deinitialize", referenced from:
>
>       __cgo_04342578f756_Cfunc_enet_deinitialize in cgo.cgo2.o
>
>      (maybe you meant: __cgo_04342578f756_Cfunc_enet_deinitialize)
>
>   "_enet_initialize", referenced from:
>
>       __cgo_04342578f756_Cfunc_enet_initialize in cgo.cgo2.o
>
>      (maybe you meant: __cgo_04342578f756_Cfunc_enet_initialize)
>
> ld: symbol(s) not found for architecture x86_64
>
> clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)
>
>
>

-- 
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