Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with cross compilation for Windows #22

Open
es1o opened this issue Nov 18, 2021 · 3 comments
Open

Problem with cross compilation for Windows #22

es1o opened this issue Nov 18, 2021 · 3 comments

Comments

@es1o
Copy link

es1o commented Nov 18, 2021

Hello.
I'm trying to compile code for windows from MacOS and Linux and I've got an error:

app.Enable undefined (type *autostart.App has no field or method Enable)

My code:

     if runtime.GOOS == "windows" {
		exe, _ := os.Executable()
		app := &autostart.App{
			Name:        "test",
			DisplayName: "test",
			Exec:        []string{exe},
		}
		app.Enable()
	}
@obuchmann
Copy link

Any News on that? I'm getting the same error

@kamushadenes
Copy link

Make sure to have CGO_ENABLED=1

@arkan
Copy link

arkan commented Jun 21, 2023

I'm on mac and I needed to do the following in order to compile the code for Windows

$> brew install mingw-w64
$> GOARCH=amd64 GOOS=windows CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build cmd/main.go

And voila!

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

No branches or pull requests

4 participants