EDITED for future reference.
You set your 'GOROOT' wrong. Set it to C:\Go\
Include C:\Go\bin to your 'Path'
I'm trying to cross compile a project that depends on a C library. I get this error during build:
aarch64-unknown-linux-musl-gcc: error: unrecognized command line option '-m64'
In go env I see GOGCCFLAGS has -m64. I know I can't change GOGCCFLAGS directly, so is there anyway I can tell go to not add that compiler option? I can imagine that there can be a version of such a cross compiler that would accept this compiler option, but I don't know how to get it.
mingw w64 - 'CGO_CFLAGS' is not recognized as an internal or external command, - Stack Overflow
windows - Golang: Getting started - "go" is not recognized as an internal or external command" - Stack Overflow
go - unable to set CGO_ENABLED=1 - Stack Overflow
cmd/go: cannot compile Go binary with external linking without cgo with v1.22.0
This should work:
Copygo env -w CGO_ENABLED=1
But if you don't have a C compiler installed on your machine, you will get another error message after setting this variable and trying to use go run -race .:
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in %PATH%
If so, here are VS Code's instructions on how to install it
- Windows: https://code.visualstudio.com/docs/cpp/config-mingw
- Linux: https://code.visualstudio.com/docs/cpp/config-linux
You can write a batch script run.bat to run your code:
Copyset CGO_ENABLED=1
go run -race .
To accomplish this in Visual Studio Code, you can modify the environment variables via a launch script, see this question:
Is there any way to set environment variables in Visual Studio Code?
hi guys, I was trying to show off MHFZ to a friend of mine yesterday after I was able to create a server and login into MHFZ but then this error happened. I didn't change any file location and I followed the guide faithfully. I tried to delete everything and extract them from the zip file again but the error is still there please help me.