GCC unable to compile Go Program

后端 未结 1 1686
余生分开走
余生分开走 2021-01-27 20:25

I wrote a very simple program in Go using using a 2D game library.

package main

import (
    \"github.com/hajimehoshi/ebiten\"
    \"github.com/hajimehoshi/ebit         


        
1条回答
  •  生来不讨喜
    2021-01-27 20:45

    So your C compiler does not support 64 bit compilation. One way to resolve this is to build in 32 bit mode. Go will by default try to build for the system architecture that you are on but you can modify that behavior by setting the environment variable GOARCH=386 before building. On Windows you can type this into your cmd:

    set GOARCH=386
    go build
    

    You could create a simple .bat batch script with this content and run that when you want to build.

    Note that 64 bit systems will run 32 bit programs just fine. This is also a nice way to make sure that when you give the .exe to someone else, it will run on their system (not considering other dependencies).

    If you want to upgrade your C compiler instead to build 64 bit applications, see this SO thread, maybe that helps.

    0 讨论(0)
提交回复
热议问题