go语言怎么编译多个文件
pallas0328
2010-02-13
//main.go
package main import "./console" func main() { console.Write("Hello world"); } //console.go package console import "os" import "bufio" func ReadLine() string { reader := bufio.NewReader(os.Stdin); text,_ := reader.ReadString(0x0a); return text; } func Write(text string) { os.Stdout.WriteString(text); } |
|
pallas0328
2010-02-13
win下的GO编译器下载http://code.google.com/p/go-windows/
先设置环境变量 set GOROOT=c:\go set GOOS=mingw set GOARCH=386 set PATH=c:\go\bin 8g console.go //编译console.go为console.8 gopack grc console.a console.8 //把console.8打包成console.a 8g main.go //编译main.go为main.8 8l main.8 //链接文件,生成8.exe |