Windows version not compatible with Goland. Programs will not run
Answered
I keep getting this error message below whenever I try to run a program and cannot seem to figure out the issue.
Cannot run program "C:\Users\(username)\AppData\Local\JetBrains\GoLand2023.3\tmp\GoLand\___go_build_awesomeProject.exe" (in directory "C:\Users\(username)\GolandProjects\awesomeProject"): CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publishe
Please sign in to leave a comment.
Hi there,
Thank you for your message and sorry to hear about the troubles you're having while running the code. To check this further, here's what I'd like to clarify:
Thank you and I hope to hear from you soon!
1. I am running the basic “Hello World” code
package awesomeProject
import “fmt”
func main() {
fmt.Println("Hello World")
}
2. Happens on all my projects. I don't think I did my go build wrong but could that be the issue
3. I am new to Go and Goland so I have not used it before this
4. 2024_01_29_BvDn6DAHry24kuLQiLis2y Here is the upload id for the files
Hi there!
Thank you so much for the details provided, those helped a lot. I believe the root cause of the issue here would be with the code you're running (specifically, the package name - awesomeProject).
Could you please check if changing the package name to "main" makes any difference? Please try this code:
In Go language, the main executable function would run inside of the "package main" only, hence, this is the most probable cause of the issue.
Thank you and please let me know how it goes.
Changing the package to main did work thank you! Do the name of functions have to be the same as packages in Go?
This rule applies to the executable package only (executable package main should contain special function main() which will execute the application). Other packages used in the project can have arbitrary names with arbitrary functions - those will not be directly executed, but would be used after import inside of func main(). I hope my explanation makes some sense.