1. 程式人生 > >ubuntu下c/c++/python/go編譯運行

ubuntu下c/c++/python/go編譯運行

工程 ubunt ubuntu下 python 執行 ++ blog 當前 com

C語言: .c文件 編譯器gcc
//my_code下hello.c文件

$sudo apt install gcc
$gcc hello.c -o hello
$./hello

C++: .cpp文件 編譯器g++
//my_code下hello.cpp文件

$sudo apt install g++
$gcc hello.cpp -o hellocpp
$./hellocpp

python: .py文件 不用編譯
//my_code下hello.py文件

$python3 hello.py

go: .go文件 編譯器go-build
//go_code/src/test/下main.go文件

-go_code 工程文件夾

-src 項目源代碼文件夾

-test 測試代碼文件夾

-main.go 測試代碼

目錄結構學習:Go目錄結構

$sudo install golang-go
$go build   //當前目錄的代碼文件編譯成一個可執行文件test,執行與mian.go同目錄的src/test/test
$./test

ubuntu下c/c++/python/go編譯運行