FAQ
Hi!

I'm trying to use Chipmunk's C library in GO to get some physics going but
i ran into this issue where I'm not able to access any functions or
variables. Here's where I'm at.

I compiled Chipmunk using XCode, put it in my project and imported it which
works fine. The only issue is that I can't seem to access a LOT of the
functions. I can use C.cpv(0, 0) to create a vector but I can't use
functions like C.cpSpaceNew(). Here's my main:

package main

// #cgo CFLAGS: -IChipmunk/include
// #cgo CFLAGS: -IChipmunk/src
// #cgo CFLAGS: -DNDEBUG -std=gnu99
// #cgo linux LDFLAGS: -lm
//
// #define CP_USE_CGTYPES 0
// #include "chipmunk/chipmunk.h"
import "C"

func main() {
   var space = C.cpSpaceNew()
   var test = C.cpv(0, 0)
   println(test.x)
}

And here's the error I get:

Zacs-MacBook-Pro:CTest Zac$ go run main.go

*# command-line-arguments*

*Undefined symbols for architecture x86_64:*

* "_cpSpaceNew", referenced from:*

* __cgo_39cd38e24839_Cfunc_cpSpaceNew in main.cgo2.o*

* (maybe you meant: __cgo_39cd38e24839_Cfunc_cpSpaceNew)*

*ld: symbol(s) not found for architecture x86_64*

*clang: error: linker command failed with exit code 1 (use -v to see
invocation)*


I can't figure out what this error means. Does anyone know whats up?


I suspect it's something to do with the way I set up my project so I'll
attach it as a zip.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Zacharyholland at Mar 14, 2016 at 5:19 am
    Here's my project
    https://bitbucket.org/Diericx/chipmunktest/src
    On Sunday, March 13, 2016 at 10:03:58 PM UTC-7, zachary...@gmail.com wrote:

    Hi!

    I'm trying to use Chipmunk's C library in GO to get some physics going but
    i ran into this issue where I'm not able to access any functions or
    variables. Here's where I'm at.

    I compiled Chipmunk using XCode, put it in my project and imported it
    which works fine. The only issue is that I can't seem to access a LOT of
    the functions. I can use C.cpv(0, 0) to create a vector but I can't use
    functions like C.cpSpaceNew(). Here's my main:

    package main

    // #cgo CFLAGS: -IChipmunk/include
    // #cgo CFLAGS: -IChipmunk/src
    // #cgo CFLAGS: -DNDEBUG -std=gnu99
    // #cgo linux LDFLAGS: -lm
    //
    // #define CP_USE_CGTYPES 0
    // #include "chipmunk/chipmunk.h"
    import "C"

    func main() {
    var space = C.cpSpaceNew()
    var test = C.cpv(0, 0)
    println(test.x)
    }

    And here's the error I get:

    Zacs-MacBook-Pro:CTest Zac$ go run main.go

    *# command-line-arguments*

    *Undefined symbols for architecture x86_64:*

    * "_cpSpaceNew", referenced from:*

    * __cgo_39cd38e24839_Cfunc_cpSpaceNew in main.cgo2.o*

    * (maybe you meant: __cgo_39cd38e24839_Cfunc_cpSpaceNew)*

    *ld: symbol(s) not found for architecture x86_64*

    *clang: error: linker command failed with exit code 1 (use -v to see
    invocation)*


    I can't figure out what this error means. Does anyone know whats up?


    I suspect it's something to do with the way I set up my project so I'll
    attach it as a zip.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Kevin Malachowski at Mar 14, 2016 at 5:19 am
    Nay chance you compiled Chipmunk for x86 (32-bit) instead of x86_64 (64-bit).

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Kevin Malachowski at Mar 14, 2016 at 5:20 am
    That should have been "Any chance..." and end with a '?' (On mobile, sorry)

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Zacharyholland at Mar 14, 2016 at 6:55 am
    Hahahaha I just checked and under Build Settings the architecture is set to
    64-bit intel :/
    On Sunday, March 13, 2016 at 10:20:37 PM UTC-7, Kevin Malachowski wrote:

    That should have been "Any chance..." and end with a '?' (On mobile, sorry)
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Zacharyholland at Mar 14, 2016 at 7:00 am
    This repo <https://github.com/paulcoyle/gochipmunk> says to build Chipmunk
    using something like this:

    "cmake -D CMAKE_C_FLAGS:STRING=-DCP_USE_CGPOINTS=0 ."

    I don't really know what that means though. Is it relevant to me or only to
    that project?
    On Sunday, March 13, 2016 at 10:20:37 PM UTC-7, Kevin Malachowski wrote:

    That should have been "Any chance..." and end with a '?' (On mobile, sorry)
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 14, '16 at 5:03a
activeMar 14, '16 at 7:00a
posts6
users2
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase