簡體   English   中英

在Windows 64位中編譯Go的問題

[英]Issue with Compiling Go in Windows 64bit

我已經為Windows 64位從gomingw安裝了Go。 但是,我找不到任何地方實際如何編譯.go文件。 這是直接從Go Wiki獲得Windows支持鏈接的程序,但是所有教程都討論了如何使用6g和gccgo等,但這些都無法在Windows機器上使用。 實際上,我想做的是,將“ hello.go”放入src文件夾,轉到src文件夾后,在命令提示符下運行命令“ 8g hello.go”。 但。 它顯示錯誤“打開一個沒有這樣的文件或目錄”。 有人可以通過提供正確的步驟在Windows中編譯go程序來幫助我嗎? 提前致謝。

導航到源代碼目錄(例如C:\\ Arpsss),顯示當前目錄,並顯示當前目錄的內容。

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的不存在的文件。

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

這是您報告的錯誤-您試圖編譯一個不在當前目錄中的名為a.go的文件。

在當前目錄中編譯,鏈接和運行hello.go Go源文件。

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

hello.go程序。

package main

import "fmt"

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM