Reputation: 171
I have imported the fyne GUI , and now my GoLang compiler that there is an error imported the files because the build constraints.
I have tried cleaning out caches using commands from this post, which asks about VS Code in Windows, the same IDE and OS I am using:
build constraints exclude all Go files in
I made sure I had Gcc C compiler downloaded, which may have contributed to my problem.
I still got the following errors in my source code (with respective import statements)
// RecursivePlant.go package main // create Gui's import (
// "fmt"
"image"
"image/color"
"image/draw"
"image/png"
"math"
"os"
"time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/widget"
)
"error while importing fyne.io/fyne/v2/app: build constraints exclude all Go files in C:\Users\geniu\go\pkg\mod\github.com\go-gl\[email protected]\v3.2-core\gl"
// RecursiveNoise.go package main
import ( "image" "image/color" "image/draw" "image/png" "math/rand" "os" "time" "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/canvas" "fyne.io/fyne/v2/widget" )
"error while importing fyne.io/fyne/v2/app: build constraints exclude all Go files in C:\Users\geniu\go\pkg\mod\github.com\go-gl\[email protected]\v3.2-core\gl"
and the go.mod file:
module example.com/hello go 1.20 require fyne.io/fyne/v2 v2.3.5
with error message:
"error while importing fyne.io/fyne/v2/internal/painter/gl: build constraints exclude all Go files in C:\Users\geniu\go\pkg\mod\github.com\go-gl\[email protected]\v3.2-core\gl"
I have been studying up on build constraints but I am unclear on which constraint to use (based on operating system, compiler, development stage etc) and which files to but the build constraints in. I don't know which part of my go or fyne files have this problem.
Upvotes: 1
Views: 5976
Reputation: 574
Make sure you have install C compiler and go to environmental variables and add this path to the Path: C:\MinGW\bin
Upvotes: 0
Reputation: 3285
You don’t need to “use” any constraints, it is all automatic Probably VSCode cannot find your C compiler. Typically this is because it is set up only on a different terminal (MSYS2 for example only configures it’s own window.
First try compiling from the place you set up the C compiler. Get that working (following our docs perhaps) then at leas you know the tools are all installed. https://developer.fyne.io/started/
Upvotes: 1