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

Error Building For Windows #147

Open
ququip123 opened this issue Jul 16, 2024 · 1 comment
Open

Error Building For Windows #147

ququip123 opened this issue Jul 16, 2024 · 1 comment
Labels
question Further information is requested

Comments

@ququip123
Copy link

Compiling an app for windows amd64 gives me this error below, I tested this on both Linux (Fedora 40) & Windows 10 in a VM:

$ CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 go build -o windows-amd64.exe cmd/main.go


# github.com/diamondburned/gotk4/pkg/core/gbox
In file included from _cgo_export.c:4:
cgo-gcc-export-header-prolog:49:35: error: conflicting types for 'callbackDelete'; have 'void(GoUintptr)' {aka 'void(long long unsigned int)'}
box.go:6:14: note: previous declaration of 'callbackDelete' with type 'void(guintptr)' {aka 'void(long unsigned int)'}
_cgo_export.c:26:28: error: conflicting types for 'callbackDelete'; have 'void(GoUintptr)' {aka 'void(long long unsigned int)'}
   26 | __declspec(dllexport) void callbackDelete(GoUintptr ptr)
      |                            ^~~~~~~~~~~~~~
box.go:6:14: note: previous declaration of 'callbackDelete' with type 'void(guintptr)' {aka 'void(long unsigned int)'}

here's a simple test app that has the same error:

package main

import (
	"log"
	"os"

	"github.com/diamondburned/gotk4/pkg/gdk/v4"
	"github.com/diamondburned/gotk4/pkg/gio/v2"
	"github.com/diamondburned/gotk4/pkg/gtk/v4"
)

func main() {
	app := gtk.NewApplication("com.test.asdf", gio.ApplicationFlagsNone)
	app.ConnectActivate(func() { activate(app) })

	if code := app.Run(os.Args); code > 0 {
		log.Println("error code: %d", code)
	}
}

func activate(app *gtk.Application) {
	window := gtk.NewApplicationWindow(app)
	window.SetDefaultSize(800, 500)

	gtk.StyleContextAddProviderForDisplay(
		gdk.DisplayGetDefault(),
		loadCSS(""),
		gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
	)

	child := gtk.NewLabel("test")

	window.SetChild(child)
	window.SetVisible(true)
}

func loadCSS(content string) *gtk.CSSProvider {
	prov := gtk.NewCSSProvider()
	// ...
	return prov
}
@diamondburned
Copy link
Owner

This is probably building for 32-bit C. Here, guintptr is defined as long unsigned int which is a 32-bit type.

@diamondburned diamondburned added the question Further information is requested label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants