goclipse
goclipse copied to clipboard
Executable file doesn't exist
i'm new to Go and GoClipse and i'm not able to compile a simple "hello World" on my linux machine. Here is my configuration:
- Eclipse Mars.2
- GoClipse 0.16.1
On Windows->Preferences->Go:
- Go installation: /usr/lib/go-1.7
- GOPATH: :/root/go
On Windows->Preferences->Go->tools:
- gocode: /root/go/bin/gocode
- guru: /root/go/bin/guru
- godef: /root/go/bin/godef
- gofmt: /usr/lib/go-1.7/bin/gofmt (Use default location)
The output of go env
is:
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/lib/go-1.7"
GOTOOLDIR="/usr/lib/go-1.7/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build306567185=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
I've tried t compile the following "hello world" code
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
But i have this error message:
Executable file (/root/workspace/Test/bin/Test) doesnt exist.
What's wrong? How can i configure eclipse properly? Thanks
What's the output of the Go build console when you build your project? The build console looks like this:
With your GOPATH setting, the executable should have been outputted to /root/go/bin/Test
I also met same problem, I can't understand why the executable outputted to system variable "GOBIN".
Which error do you have?
Are you using Eclipse on Linux? Did you have installed Go with apt install
?
You should configure the path in your eclipse project
The error is "Executable file does not exists", I have install Golang, Eclipse on my windows machine. Maybe I should change default build command to solve the problem.
I'm using eclipse on linux, but the problem is the same. Try this:
- Create an "hello world" go project in eclipse
- Right click on your folder project and then click on
Properties
-
Go Compiler
->Go Installation
- Set the folder where your Go binaries are installed
- Then build and run you project
I managed to find the issue, It is no configuration issue or anything. You have to do 3 things as follows,
- Make sure GOPATH value is different from GOROOT.
- Make sure GOBIN value is empty.
- Your package name on the go file in eclipse should be main and not the package name "hello". This should be the case for at least the file that has main function. To do this, File->New go file->Source file type should be -> Command source file-> Empty main function. Then type your code after which you can build to see the the .exe file in GOPATH/bin and the program run.
Worked for me.