简体   繁体   English

如何在 Windows 中使用 github.com/AllenDang/giu 和 github.com/gordonklaus/portaudio 构建 GO 程序

[英]how to build a GO program using github.com/AllenDang/giu and github.com/gordonklaus/portaudio in Windows

When I try to build a Go program which uses 'github.com/gordonklaus/portaudio' and 'github.com/AllenDang/giu' I got C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running x86_64-w64-mingw32-g++ failed: exit status 1 When I tested to build Go programs using those packages separated ('github.com/gordonklaus/portaudio' and 'github.com/AllenDang/giu') the programs build properly and run as expected.当我尝试构建一个使用 'github.com/gordonklaus/portaudio' 和 'github.com/AllenDang/giu' 的 Go 程序时,我得到了C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running x86_64-w64-mingw32-g++ failed: exit status 1当我测试使用这些分开的包('github.com/gordonklaus/portaudio'和'github.com/AllenDang/giu')构建Go程序时,程序正确构建并运行正如预期的那样。

I am wondering if it is something related to the compiled portaudio in MINGW4我想知道它是否与 MINGW4 中已编译的 portaudio 有关

reproducible example:可重现的例子:


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()
}

the stack error when I try to build runing go run -x main.go :当我尝试构建运行时的堆栈错误go run -x main.go

# command-line-arguments
C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running x86_64-w64-mingw32-g++ failed: exit status 1
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_util.c.obj):(.text+0xda): undefined reference to `__imp_timeGetTime'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_ds.c.obj):(.text+0x142): undefined reference to `__imp_timeEndPeriod'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_ds.c.obj):(.text+0xd15): undefined reference to `__imp_timeGetDevCaps'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_ds.c.obj):(.text+0xd58): undefined reference to `__imp_timeBeginPeriod'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_ds.c.obj):(.text+0x2202): undefined reference to `__imp_timeEndPeriod'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x2f7): undefined reference to `__imp_waveOutWrite'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x2fe): undefined reference to `__imp_waveOutGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x457): undefined reference to `__imp_waveInAddBuffer'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x45e): undefined reference to `__imp_waveInGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x601): undefined reference to `__imp_waveOutReset'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x64a): undefined reference to `__imp_waveOutGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x6c9): undefined reference to `__imp_waveInReset'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x70e): undefined reference to `__imp_waveInGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x908): undefined reference to `__imp_waveOutOpen'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x94b): undefined reference to `__imp_waveOutGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0xa18): undefined reference to `__imp_waveInOpen'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0xa5b): undefined reference to `__imp_waveInGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0xb33): undefined reference to `__imp_waveOutUnprepareHeader'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0xc23): undefined reference to `__imp_waveInUnprepareHeader'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0xdfd): undefined reference to `__imp_waveInPrepareHeader'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0xe0c): undefined reference to `__imp_waveOutPrepareHeader'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0xe8c): undefined reference to `__imp_waveInUnprepareHeader'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0xf0a): undefined reference to `__imp_waveOutUnprepareHeader'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x1066): undefined reference to `__imp_waveInGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x16fc): undefined reference to `__imp_waveInAddBuffer'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x177b): undefined reference to `__imp_waveInGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x182d): undefined reference to `__imp_waveOutPause'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x186f): undefined reference to `__imp_waveOutGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x189e): undefined reference to `__imp_waveOutWrite'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x198c): undefined reference to `__imp_waveOutGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x1c35): undefined reference to `__imp_waveInStart'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x1c7c): undefined reference to `__imp_waveOutRestart'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x1d63): undefined reference to `__imp_waveOutReset'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x1d6a): undefined reference to `__imp_waveOutGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x1dc9): undefined reference to `__imp_waveInReset'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x1dd0): undefined reference to `__imp_waveInGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x2720): undefined reference to `__imp_waveOutGetPosition'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x2bd7): undefined reference to `__imp_waveInClose'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x2bfc): undefined reference to `__imp_waveInGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x2c6d): undefined reference to `__imp_waveOutClose'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x2c92): undefined reference to `__imp_waveOutGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x2fa5): undefined reference to `__imp_waveOutOpen'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x2ff1): undefined reference to `__imp_waveOutOpen'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x3049): undefined reference to `__imp_waveOutGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x3112): undefined reference to `__imp_waveInOpen'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x315a): undefined reference to `__imp_waveInOpen'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x31a2): undefined reference to `__imp_waveInGetErrorTextW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x4caa): undefined reference to `__imp_waveInMessage'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x4cdd): undefined reference to `__imp_waveOutMessage'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x4d16): undefined reference to `__imp_waveInGetNumDevs'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x4d2b): undefined reference to `__imp_waveOutGetNumDevs'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x4ee2): undefined reference to `__imp_waveInGetDevCapsW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x51da): undefined reference to `__imp_waveOutGetNumDevs'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wmme.c.obj):(.text+0x5652): undefined reference to `__imp_waveOutGetDevCapsW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x3525): undefined reference to `__imp_CoGetInterfaceAndReleaseStream'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x3599): undefined reference to `__imp_CoGetInterfaceAndReleaseStream'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x3969): undefined reference to `__imp_CoInitializeEx'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x39b9): undefined reference to `__imp_timeGetDevCaps'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x39d2): undefined reference to `__imp_timeBeginPeriod'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x3cb2): undefined reference to `__imp_timeEndPeriod'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x3db2): undefined reference to `__imp_CoUninitialize'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x3dc2): undefined reference to `__imp_CoUninitialize'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x3e82): undefined reference to `__imp_CoInitializeEx'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x3ec6): undefined reference to `__imp_timeGetDevCaps'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x3ee1): undefined reference to `__imp_timeBeginPeriod'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x43b1): undefined reference to `__imp_timeGetTime'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x44e3): undefined reference to `__imp_timeEndPeriod'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x46a2): undefined reference to `__imp_timeGetTime'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x46d2): undefined reference to `__imp_timeGetTime'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x4a27): undefined reference to `__imp_CoUninitialize'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x4a32): undefined reference to `__imp_CoUninitialize'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x542c): undefined reference to `__imp_CoMarshalInterThreadInterfaceInStream'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x54de): undefined reference to `__imp_CoGetInterfaceAndReleaseStream'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x5573): undefined reference to `__imp_CoMarshalInterThreadInterfaceInStream'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x569e): undefined reference to `__imp_CoGetInterfaceAndReleaseStream'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x5a94): undefined reference to `__imp_CoTaskMemFree'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x8284): undefined reference to `__imp_CoCreateInstance'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x8355): undefined reference to `__imp_CoTaskMemFree'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x85b3): undefined reference to `__imp_CoTaskMemFree'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x86d7): undefined reference to `__imp_CoTaskMemFree'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x87b4): undefined reference to `__imp_PropVariantClear'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x883e): undefined reference to `__imp_PropVariantClear'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x8894): undefined reference to `__imp_PropVariantClear'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x8ced): undefined reference to `__imp_PropVariantClear'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wasapi.c.obj):(.text+0x8cf9): undefined reference to `__imp_CoTaskMemFree'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x23b6): undefined reference to `__imp_timeEndPeriod'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x2502): undefined reference to `__imp_timeBeginPeriod'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x2656): undefined reference to `__imp_timeGetTime'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x5f13): undefined reference to `__imp_SetupDiGetClassDevsW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x5f27): undefined reference to `__imp_SetupDiGetDeviceInterfaceAlias'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x5fb3): undefined reference to `__imp_SetupDiEnumDeviceInterfaces'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x6112): undefined reference to `__imp_SetupDiGetDeviceInterfaceAlias'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x6194): undefined reference to `__imp_SetupDiGetDeviceInterfaceDetailW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x61fe): undefined reference to `__imp_SetupDiEnumDeviceInterfaces'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x6411): undefined reference to `__imp_SetupDiGetDeviceRegistryPropertyW'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x643a): undefined reference to `__imp_SetupDiOpenDeviceInterfaceRegKey'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x6499): undefined reference to `__imp_SetupDiDestroyDeviceInfoList'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x64a0): undefined reference to `__imp_waveInMessage'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x64cf): undefined reference to `__imp_waveOutMessage'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_wdmks.c.obj):(.text+0x6cd5): undefined reference to `__imp_SetupDiDestroyDeviceInfoList'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_coinitialize.c.obj):(.text+0x1b): undefined reference to `__imp_CoInitialize'
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/tools/msys64/mingw64/lib\libportaudio.a(pa_win_coinitialize.c.obj):(.text+0x11d): undefined reference to `__imp_CoUninitialize'
collect2.exe: error: ld returned 1 exit status ```


The errors indicate you need to link with the libraries your code (or the dependencies) depends on.这些错误表明您需要链接您的代码(或依赖项)所依赖的库。

Try adding these linker flags:尝试添加这些链接器标志:

  • -lshell32 -lshell32
  • -lole32 -lole32
  • -limm32 -limm32
  • -lwinmm -lwinmm
  • -liprop -liprop
  • -lsetupapi -lsetupapi

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用git bash下载lexandera / Aardwolf.git(Windows); 致命错误-无法连接到github.com - downloading lexandera/Aardwolf.git using git bash (Windows); fatal error - unable to connec to github.com 使用ssh在Windows下克隆github.com的repo时,“没有与name关联的地址”错误 - “no address associated with name” error when cloning github.com's repo under Windows using ssh Github Windows:从命令行创建的新分支未显示在 github.com 上 - Github Windows: New branch created from command line not showing up on github.com 为什么“去获取github.com/…”行得通,为什么“去获取gopkg.in/…”行不行? - Why doesn't “go get gopkg.in/…” work while “go get github.com/…” OK? OpenSSL SSL_connect:连接被重置连接到 github.com:443 git windows - OpenSSL SSL_connect: Connection was reset in connection to github.com:443 git windows 无法构建 github.com/jonpchin/gochess - “工作目录不是模块的一部分” - Cannot build github.com/jonpchin/gochess - “working directory is not part of a module” ssh:无法在eip = 68086014解析主机名github.com + STATUS_ACCESS_VIOLATION - ssh: Could not resolve hostname github.com + STATUS_ACCESS_VIOLATION at eip=68086014 Git 在 windows 上克隆:git@github.com 不是 ZBA9F11ECC3497BD6993B933E50Z 命令 - Git clone on windows : git@github.com is not a git command 为什么 git@github.com:Windows 中的权限被拒绝(公钥)? - Why git@github.com: Permission denied (publickey) in windows? 如何在Windows中使用MASM构建Boost(来自github)? - How to build Boost (from github) with MASM in Windows?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM