编译问题在Windows 64位 [英] Issue with Compiling Go in Windows 64bit

查看:98
本文介绍了编译问题在Windows 64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 gomingw 为Windows 64位安装了Go。但是,我找不到任何地方如何实际编译一个.go文件。这是直接从Go wiki链接到Windows支持,但所有的教程谈论使用6g和gccgo等,没有一个在我的Windows机器上的工作。实际上,我想做的是,我把我的hello.go在src文件夹,在去src文件夹后,我在命令提示符下运行命令8g hello.go。但。它显示错误打开a.go没有这样的文件或目录。任何人都可以通过提供正确的步骤来编译一个go程序在Windows中帮助我吗?提前感谢。

I have installed Go from gomingw for windows 64 bit. However, I cannot find out anywhere how to actually compile a .go file. This is the program linked directly from the Go wiki for Windows Support, but all the tutorials talk about using 6g and gccgo etc. and none of those work on my windows machine. Actually, what I am trying to do is, I put my "hello.go" in src folder and after going to src folder I run the command "8g hello.go" in command prompt. But. it showing error "open a.go no such file or directory". Can anybody help me by providing correct steps to compile a go program in Windows? Thanks in advance.

推荐答案

导航到您的源代码目录(例如C:\Arpsss),显示当前目录,并显示当前目录内容。

Navigate to your source code directory (for example, C:\Arpsss), display the current directory, and display the current directory contents.

C:\>cd C:\Arpssss
C:\Arpssss>cd
C:\Arpssss
C:\Arpssss>dir
 Volume in drive C has no label.
 Directory of C:\Arpssss
11/28/2011  10:26 AM    <DIR>          .
11/28/2011  10:26 AM    <DIR>          ..
11/28/2011  10:24 AM                73 hello.go
               1 File(s)             73 bytes
               2 Dir(s)   4,949,831,680 bytes free

尝试编译名为 a.go 的不存在文件。

Try to compile a non-existent file named a.go.

C:\Arpssss>8g a.go
open a.go: No such file or directory

这是你报告的错误 - 你试图编译一个名为 a.go <

This is the error you reported--you tried to compile a file named a.go that wasn't in your current directory.

在当前目录中编译,链接和运行hello.go Go源文件。

Compile, link, and run the hello.go Go source file in the current directory.

C:\Arpssss>8g hello.go
C:\Arpssss>8l -o hello.exe hello.8
C:\Arpssss>hello
Hello, World!

hello.go p>

The hello.go program.

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

这篇关于编译问题在Windows 64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆