-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
Compiling for windows #89
Comments
I think this is a problem with your installation of your tools. When you have installed Go and MinGW correctly, you should be able to compile and run the following program just fine. package main
//#include <stdlib.h>
import "C"
func main() {
data := C.malloc(4)
C.free(data)
} |
Yep, it works well, but when i try to compile a game with sdl it doesn't work
Don't u know why? And one more: i've tried first to crosscompile it, but it shows
Googled it, but no answers at all. Even cant find any info bout "-mthreads" flag |
Whats the difference between main2.go and main.go? Are you sure that you have a clean version of this library? Does Can you run the examples/events.go ? Cross-compiling with cgo is a little tricky, I haven't done it in a while because it was too much of a bother the first time. I'm not very familar with it, but at the very least you have to make sure it calls a cross-compiling version of gcc instead of the regular gcc. mthreads |
main.go is my game, main2.go is ur source ive installed it like on linux
So i cant try examples :C Thnx a lot, btw dont u know how to define a mingw cross-compiler?
When i try to use cc, it show the mthreads error again
|
I still can't really tell where the error you're having is coming from... So if you take a clean copy of go-sdl2 and add As for the cross-compilation, you'd be better off finding somebody familiar with it, try golang-nuts. |
omg, added
|
That's pretty telling, I believe that this is the result of not having SDL2 installed correctly (for MinGW that is). I still can't quite reproduce your output, but you could try re-copying the *.a files for SDL2 to mingw's lib folder (making sure to use the 32-bit version if you're still using 32-bit mingw & go). As a more general course of action, try to get a simple C sdl program working. |
Thnx a lot, it turned out that crosscompiling is much easier then compiling on win :D |
@HaCk3Dq In case you want to try setting go-sdl2 up on Windows again, I put together a step-by-step guide here: https://gist.github.com/Decker108/7df1726192433a3bdb32 |
You might be interested in issue 382. If we can remove CGo on Windows, you only need a Go compiler and the |
I am trying to compile a game for windows, it works great on linux.
I have installed all needed stuff such as 32 bit Golang, SDL2, MinGW and so on.
After trying to build it i get this error:
I've googled it, found that I should add an include for stdio "// #include <stdlib.h"
But i dont know where to do it, added in almost any file but it does not help
The text was updated successfully, but these errors were encountered: