當(dāng)我嘗試構(gòu)建一個(gè)使用“github.com/gordonklaus/portaudio”和“github.com/AllenDang/giu”的 Go 程序時(shí),我得到了C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running x86_64-w64-mingw32-g++ failed: exit status 1 當(dāng)我測(cè)試使用這些分開(kāi)的包構(gòu)建 Go 程序時(shí)(“github.com/gordonklaus/ portaudio”和“github.com/AllenDang/giu”)程序正確構(gòu)建并按預(yù)期運(yùn)行。我想知道它是否與 MINGW4 中編譯的 portaudio 有關(guān)可重現(xiàn)的例子:import ( "log" "os" "os/signal" g "github.com/AllenDang/giu" "github.com/go-audio/audio" "github.com/go-audio/generator" "github.com/gordonklaus/portaudio")func RunAudio() { portaudio.Initialize() defer portaudio.Terminate() out := make([]float32, 2048) buf := &audio.FloatBuffer{ Data: make([]float64, 2048), Format: audio.FormatStereo44100, } //*************************** currentNote := 440.0 osc := generator.NewOsc(generator.WaveSine, currentNote, buf.Format.SampleRate) osc.Amplitude = 1 osc.Freq = 440.0 sig := make(chan os.Signal, 1) signal.Notify(sig, os.Interrupt, os.Kill) stream, err := portaudio.OpenDefaultStream(0, 2, 44100, len(out), &out) if err != nil { log.Fatal(err) } log.Println("dsp running") defer stream.Close() if err := stream.Start(); err != nil { log.Fatal(err) } defer stream.Stop() for { if err := osc.Fill(buf); err != nil { log.Printf("error filling up the buffer") } f64ToF32Mixing(out, buf) // write to the stream if err := stream.Write(); err != nil { log.Printf("error writing to stream : %v\n", err) } }}func f64ToF32Mixing(dst []float32, buf *audio.FloatBuffer) { for i := range buf.Data { dst[i] = float32(buf.Data[i]) }}func loop() { g.Window("test").Layout( g.Label("hello world"), )}func main() { wnd := g.NewMasterWindow("Hello synth", 700, 700, g.MasterWindowFlagsTransparent) go wnd.Run(loop) RunAudio()}
1 回答

蝴蝶刀刀
TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超8個(gè)贊
錯(cuò)誤表明您需要鏈接您的代碼(或依賴項(xiàng))所依賴的庫(kù)。
嘗試添加這些鏈接器標(biāo)志:
-lshell32
蘿莉32
-limm32
-lwinmm
-脂肪醇
- lsetupapi
- 1 回答
- 0 關(guān)注
- 104 瀏覽
添加回答
舉報(bào)
0/150
提交
取消