程式語言 - Wine - 解決undefined reference to wglDeleteContext問題



問題如下:

$ winegcc main.c -o main.exe -lGL -lGLU -lgdi32
    /usr/bin/ld: tmp6aec8478/main-00000000.o: in function `KillGLWindow':
    main.c:(.text+0x1ed): undefined reference to `wglMakeCurrent'
    /usr/bin/ld: main.c:(.text+0x234): undefined reference to `wglDeleteContext'
    /usr/bin/ld: tmp6aec8478/main-00000000.o: in function `CreateGLWindow':
    main.c:(.text+0x829): undefined reference to `wglCreateContext'
    /usr/bin/ld: main.c:(.text+0x89e): undefined reference to `wglMakeCurrent'
    /usr/bin/ld: main.exe.so: hidden symbol `wglDeleteContext' isn't defined
    /usr/bin/ld: final link failed: bad value
    collect2: error: ld returned 1 exit status
    winegcc: /usr/bin/gcc failed

解法如下:

$ winegcc main.c -o main.exe -lGL -lGLU -lgdi32 -lopengl32