Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Executable file doesn't exist #236

Open
AlvinAlvin82 opened this issue Jan 8, 2017 · 6 comments
Open

Executable file doesn't exist #236

AlvinAlvin82 opened this issue Jan 8, 2017 · 6 comments

Comments

@AlvinAlvin82
Copy link

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

@bruno-medeiros
Copy link
Contributor

What's the output of the Go build console when you build your project? The build console looks like this:
image

With your GOPATH setting, the executable should have been outputted to /root/go/bin/Test

@shadow1163
Copy link

I also met same problem, I can't understand why the executable outputted to system variable "GOBIN".

@AlvinAlvin82
Copy link
Author

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

@shadow1163
Copy link

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.

@AlvinAlvin82
Copy link
Author

I'm using eclipse on linux, but the problem is the same. Try this:

  1. Create an "hello world" go project in eclipse
  2. Right click on your folder project and then click on Properties
  3. Go Compiler -> Go Installation
  4. Set the folder where your Go binaries are installed
  5. Then build and run you project

@ghost
Copy link

ghost commented Jul 14, 2017

I managed to find the issue, It is no configuration issue or anything. You have to do 3 things as follows,

  1. Make sure GOPATH value is different from GOROOT.
  2. Make sure GOBIN value is empty.
  3. 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants