我的项目中 SDL2 的链接器错误

2024-03-21

我使用 CMake 和 Code::Blocks 从源代码构建 SDL2,并尝试将我自己的项目源链接到以下静态库:

libSDL2.a
libSDL2main.a
OpenGL32.lib

这三个库包含在称为%libdir%(我使用批处理命令)。

我从 Code::Blocks 构建中获得了 libSDL2 和 libSDL2main。我从 Windows 目录中获得了 OpenGL32,尽管我很久以前就找到了它,所以我无法回忆起确切的位置。我使用了以下命令:

g++ *.o -L%libDir% -lOpenGL32 -lSDL2main -lSDL -o "output.exe"

以下是日志,我该如何纠正这些错误?:

projectdir\lib/libSDL2.a(SDL_windows.c.obj): In function `WIN_CoInitialize':
sdlsrc/core/windows/SDL_windows.c:73: undefined reference to `CoInitializeEx@8'
sdlsrc/core/windows/SDL_windows.c:75: undefined reference to `CoInitializeEx@8'
projectdir\lib/libSDL2.a(SDL_windows.c.obj): In function `WIN_CoUninitialize':
sdlsrc/core/windows/SDL_windows.c:92: undefined reference to `CoUninitialize@0'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_SetupAPI':
sdlsrc/video/windows/SDL_windowskeyboard.c:617: undefined reference to `ImmGetIMEFileNameA@12'
sdlsrc/video/windows/SDL_windowskeyboard.c:630: undefined reference to `ImmGetContext@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:633: undefined reference to `ImmReleaseContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_GetId':
sdlsrc/video/windows/SDL_windowskeyboard.c:551: undefined reference to `ImmGetIMEFileNameA@12'
sdlsrc/video/windows/SDL_windowskeyboard.c:566: undefined reference to `GetFileVersionInfoSizeA@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:570: undefined reference to `GetFileVersionInfoA@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:571: undefined reference to `VerQueryValueA@16'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `UIElementSink_QueryInterface@12':
sdlsrc/video/windows/SDL_windowskeyboard.c:1013: undefined reference to `IID_IUnknown'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IPPASink_QueryInterface@12':
sdlsrc/video/windows/SDL_windowskeyboard.c:1119: undefined reference to `IID_IUnknown'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `UILess_GetCandidateList':
sdlsrc/video/windows/SDL_windowskeyboard.c:984: undefined reference to `SysFreeString@4'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_ClearComposition':
sdlsrc/video/windows/SDL_windowskeyboard.c:683: undefined reference to `ImmGetContext@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:687: undefined reference to `ImmNotifyIME@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:691: undefined reference to `ImmNotifyIME@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:692: undefined reference to `ImmReleaseContext@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:689: undefined reference to `ImmSetCompositionStringW@24'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_Disable':
sdlsrc/video/windows/SDL_windowskeyboard.c:364: undefined reference to `ImmAssociateContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `UIElementSink_BeginUIElement@12':
sdlsrc/video/windows/SDL_windowskeyboard.c:1051: undefined reference to `SysFreeString@4'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `UIElementSink_UpdateUIElement@8':
sdlsrc/video/windows/SDL_windowskeyboard.c:1078: undefined reference to `SysFreeString@4'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_Init':
sdlsrc/video/windows/SDL_windowskeyboard.c:309: undefined reference to `CoCreateInstance@20'
sdlsrc/video/windows/SDL_windowskeyboard.c:323: undefined reference to `ImmGetContext@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:324: undefined reference to `ImmReleaseContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `UILess_SetupSinks':
sdlsrc/video/windows/SDL_windowskeyboard.c:1192: undefined reference to `CoCreateInstance@20'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_ClearComposition':
sdlsrc/video/windows/SDL_windowskeyboard.c:683: undefined reference to `ImmGetContext@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:687: undefined reference to `ImmNotifyIME@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:691: undefined reference to `ImmNotifyIME@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:692: undefined reference to `ImmReleaseContext@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:689: undefined reference to `ImmSetCompositionStringW@24'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_GetId':
sdlsrc/video/windows/SDL_windowskeyboard.c:551: undefined reference to `ImmGetIMEFileNameA@12'
sdlsrc/video/windows/SDL_windowskeyboard.c:566: undefined reference to `GetFileVersionInfoSizeA@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:570: undefined reference to `GetFileVersionInfoA@16'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_GetReadingString':
sdlsrc/video/windows/SDL_windowskeyboard.c:423: undefined reference to `ImmGetContext@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:498: undefined reference to `ImmReleaseContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_GetId':
sdlsrc/video/windows/SDL_windowskeyboard.c:571: undefined reference to `VerQueryValueA@16'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_Quit':
sdlsrc/video/windows/SDL_windowskeyboard.c:378: undefined reference to `ImmAssociateContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_Enable':
sdlsrc/video/windows/SDL_windowskeyboard.c:349: undefined reference to `ImmAssociateContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_ClearComposition':
sdlsrc/video/windows/SDL_windowskeyboard.c:683: undefined reference to `ImmGetContext@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:687: undefined reference to `ImmNotifyIME@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:691: undefined reference to `ImmNotifyIME@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:692: undefined reference to `ImmReleaseContext@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:689: undefined reference to `ImmSetCompositionStringW@24'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_Disable':
sdlsrc/video/windows/SDL_windowskeyboard.c:364: undefined reference to `ImmAssociateContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `WIN_SetTextInputRect':
sdlsrc/video/windows/SDL_windowskeyboard.c:202: undefined reference to `ImmGetContext@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:209: undefined reference to `ImmSetCompositionWindow@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:210: undefined reference to `ImmReleaseContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_HandleMessage':
sdlsrc/video/windows/SDL_windowskeyboard.c:852: undefined reference to `ImmGetContext@4'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_GetCompositionString':
sdlsrc/video/windows/SDL_windowskeyboard.c:699: undefined reference to `ImmGetCompositionStringW@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:704: undefined reference to `ImmGetCompositionStringW@16'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_HandleMessage':
sdlsrc/video/windows/SDL_windowskeyboard.c:890: undefined reference to `ImmReleaseContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_ClearComposition':
sdlsrc/video/windows/SDL_windowskeyboard.c:683: undefined reference to `ImmGetContext@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:687: undefined reference to `ImmNotifyIME@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:691: undefined reference to `ImmNotifyIME@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:692: undefined reference to `ImmReleaseContext@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_HandleMessage':
sdlsrc/video/windows/SDL_windowskeyboard.c:885: undefined reference to `ImmGetContext@4'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_GetCandidateList':
sdlsrc/video/windows/SDL_windowskeyboard.c:767: undefined reference to `ImmGetCandidateListW@16'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_GetCompositionString':
sdlsrc/video/windows/SDL_windowskeyboard.c:699: undefined reference to `ImmGetCompositionStringW@16'
sdlsrc/video/windows/SDL_windowskeyboard.c:704: undefined reference to `ImmGetCompositionStringW@16'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_ClearComposition':
sdlsrc/video/windows/SDL_windowskeyboard.c:689: undefined reference to `ImmSetCompositionStringW@24'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_GetCandidateList':
sdlsrc/video/windows/SDL_windowskeyboard.c:771: undefined reference to `ImmGetCandidateListW@16'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_Render':
sdlsrc/video/windows/SDL_windowskeyboard.c:1520: undefined reference to `CreateCompatibleDC@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:1525: undefined reference to `DeleteDC@4'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_RenderCandidateList':
sdlsrc/video/windows/SDL_windowskeyboard.c:1394: undefined reference to `CreatePen@12'
sdlsrc/video/windows/SDL_windowskeyboard.c:1395: undefined reference to `CreateSolidBrush@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:1396: undefined reference to `CreatePen@12'
sdlsrc/video/windows/SDL_windowskeyboard.c:1397: undefined reference to `CreateSolidBrush@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:1398: undefined reference to `CreatePen@12'
sdlsrc/video/windows/SDL_windowskeyboard.c:1399: undefined reference to `CreateSolidBrush@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:1400: undefined reference to `CreateFontW@56'
sdlsrc/video/windows/SDL_windowskeyboard.c:1402: undefined reference to `SetBkMode@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:1403: undefined reference to `SelectObject@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:1410: undefined reference to `GetTextExtentPoint32W@16'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `StartDrawToBitmap':
sdlsrc/video/windows/SDL_windowskeyboard.c:1259: undefined reference to `CreateDIBSection@24'
sdlsrc/video/windows/SDL_windowskeyboard.c:1261: undefined reference to `SelectObject@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_RenderCandidateList':
sdlsrc/video/windows/SDL_windowskeyboard.c:1458: undefined reference to `SelectObject@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:1459: undefined reference to `SelectObject@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `DrawRect':
sdlsrc/video/windows/SDL_windowskeyboard.c:1285: undefined reference to `Rectangle@20'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_RenderCandidateList':
sdlsrc/video/windows/SDL_windowskeyboard.c:1462: undefined reference to `SelectObject@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:1463: undefined reference to `SelectObject@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:1464: undefined reference to `SetTextColor@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:1465: undefined reference to `SetBkMode@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:1496: undefined reference to `SelectObject@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:1497: undefined reference to `SelectObject@8'
sdlsrc/video/windows/SDL_windowskeyboard.c:1498: undefined reference to `SetTextColor@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `DrawRect':
sdlsrc/video/windows/SDL_windowskeyboard.c:1285: undefined reference to `Rectangle@20'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_RenderCandidateList':
sdlsrc/video/windows/SDL_windowskeyboard.c:1502: undefined reference to `ExtTextOutW@32'
sdlsrc/video/windows/SDL_windowskeyboard.c:1491: undefined reference to `SelectObject@8'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `StopDrawToBitmap':
sdlsrc/video/windows/SDL_windowskeyboard.c:1270: undefined reference to `DeleteObject@4'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj): In function `IME_RenderCandidateList':
sdlsrc/video/windows/SDL_windowskeyboard.c:1506: undefined reference to `DeleteObject@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:1507: undefined reference to `DeleteObject@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:1508: undefined reference to `DeleteObject@4'
sdlsrc/video/windows/SDL_windowskeyboard.c:1509: undefined reference to `DeleteObject@4'
projectdir\lib/libSDL2.a(SDL_windowskeyboard.c.obj):sdlsrc/video/windows/SDL_windowskeyboard.c:1510: more undefined references to `DeleteObject@4' follow
projectdir\lib/libSDL2.a(SDL_windowsmessagebox.c.obj): In function `WIN_ShowMessageBox':
sdlsrc/video/windows/SDL_windowsmessagebox.c:396: undefined reference to `CreateCompatibleDC@4'
sdlsrc/video/windows/SDL_windowsmessagebox.c:405: undefined reference to `CreateFontIndirectW@4'
sdlsrc/video/windows/SDL_windowsmessagebox.c:409: undefined reference to `SelectObject@8'
sdlsrc/video/windows/SDL_windowsmessagebox.c:413: undefined reference to `GetTextMetricsW@8'
sdlsrc/video/windows/SDL_windowsmessagebox.c:428: undefined reference to `DeleteDC@4'
projectdir\lib/libSDL2.a(SDL_windowsmessagebox.c.obj): In function `CreateDialogData':
sdlsrc/video/windows/SDL_windowsmessagebox.c:301: undefined reference to `GetDeviceCaps@8'
projectdir\lib/libSDL2.a(SDL_windowsmouse.c.obj): In function `WIN_CreateCursor':
sdlsrc/video/windows/SDL_windowsmouse.c:129: undefined reference to `CreateDIBSection@24'
sdlsrc/video/windows/SDL_windowsmouse.c:130: undefined reference to `CreateBitmap@20'
sdlsrc/video/windows/SDL_windowsmouse.c:140: undefined reference to `DeleteObject@4'
sdlsrc/video/windows/SDL_windowsmouse.c:141: undefined reference to `DeleteObject@4'
projectdir\lib/libSDL2.a(SDL_windowsshape.c.obj): In function `CombineRectRegions':
sdlsrc/video/windows/SDL_windowsshape.c:53: undefined reference to `CreateRectRgn@16'
sdlsrc/video/windows/SDL_windowsshape.c:55: undefined reference to `CombineRgn@16'
sdlsrc/video/windows/SDL_windowsshape.c:56: undefined reference to `DeleteObject@4'
projectdir\lib/libSDL2.a(SDL_windowswindow.c.obj): In function `WIN_SetWindowGammaRamp':
sdlsrc/video/windows/SDL_windowswindow.c:606: undefined reference to `CreateDCW@16'
sdlsrc/video/windows/SDL_windowswindow.c:608: undefined reference to `SetDeviceGammaRamp@8'
sdlsrc/video/windows/SDL_windowswindow.c:612: undefined reference to `DeleteDC@4'
projectdir\lib/libSDL2.a(SDL_windowswindow.c.obj): In function `WIN_GetWindowGammaRamp':
sdlsrc/video/windows/SDL_windowswindow.c:625: undefined reference to `CreateDCW@16'
sdlsrc/video/windows/SDL_windowswindow.c:627: undefined reference to `GetDeviceGammaRamp@8'
sdlsrc/video/windows/SDL_windowswindow.c:631: undefined reference to `DeleteDC@4'
projectdir\lib/libSDL2.a(SDL_systimer.c.obj): In function `SDL_SetSystemTimerResolution':
sdlsrc/timer/windows/SDL_systimer.c:57: undefined reference to `timeBeginPeriod@4'
sdlsrc/timer/windows/SDL_systimer.c:51: undefined reference to `timeEndPeriod@4'
projectdir\lib/libSDL2.a(SDL_systimer.c.obj): In function `SDL_TicksInit':
sdlsrc/timer/windows/SDL_systimer.c:102: undefined reference to `timeGetTime@0'
projectdir\lib/libSDL2.a(SDL_systimer.c.obj): In function `SDL_SetSystemTimerResolution':
sdlsrc/timer/windows/SDL_systimer.c:51: undefined reference to `timeEndPeriod@4'
projectdir\lib/libSDL2.a(SDL_systimer.c.obj): In function `SDL_GetTicks_REAL':
sdlsrc/timer/windows/SDL_systimer.c:141: undefined reference to `timeGetTime@0'
projectdir\lib/libSDL2.a(SDL_systimer.c.obj): In function `SDL_TicksInit':
sdlsrc/timer/windows/SDL_systimer.c:102: undefined reference to `timeGetTime@0'
projectdir\lib/libSDL2.a(SDL_systimer.c.obj): In function `SDL_GetTicks_REAL':
sdlsrc/timer/windows/SDL_systimer.c:141: undefined reference to `timeGetTime@0'
projectdir\lib/libSDL2.a(SDL_systimer.c.obj): In function `SDL_TicksInit':
sdlsrc/timer/windows/SDL_systimer.c:102: undefined reference to `timeGetTime@0'
projectdir\lib/libSDL2.a(SDL_mmjoystick.c.obj): In function `SDL_SYS_JoystickInit':
sdlsrc/joystick/windows/SDL_mmjoystick.c:166: undefined reference to `joyGetNumDevs@0'
sdlsrc/joystick/windows/SDL_mmjoystick.c:171: undefined reference to `joyGetPosEx@8'
sdlsrc/joystick/windows/SDL_mmjoystick.c:173: undefined reference to `joyGetDevCapsA@12'
projectdir\lib/libSDL2.a(SDL_mmjoystick.c.obj): In function `SDL_SYS_JoystickUpdate':
sdlsrc/joystick/windows/SDL_mmjoystick.c:326: undefined reference to `joyGetPosEx@8'
projectdir\lib/libSDL2.a(SDL_winmm.c.obj): In function `WINMM_CloseDevice':
sdlsrc/audio/winmm/SDL_winmm.c:170: undefined reference to `waveOutUnprepareHeader@12'
sdlsrc/audio/winmm/SDL_winmm.c:170: undefined reference to `waveOutUnprepareHeader@12'
sdlsrc/audio/winmm/SDL_winmm.c:182: undefined reference to `waveInClose@4'
sdlsrc/audio/winmm/SDL_winmm.c:187: undefined reference to `waveOutClose@4'
projectdir\lib/libSDL2.a(SDL_winmm.c.obj): In function `WINMM_PlayDevice':
sdlsrc/audio/winmm/SDL_winmm.c:131: undefined reference to `waveOutWrite@12'
projectdir\lib/libSDL2.a(SDL_winmm.c.obj): In function `SetMMerror':
sdlsrc/audio/winmm/SDL_winmm.c:106: undefined reference to `waveOutGetErrorTextW@12'
projectdir\lib/libSDL2.a(SDL_winmm.c.obj): In function `WINMM_OpenDevice':
sdlsrc/audio/winmm/SDL_winmm.c:285: undefined reference to `waveOutOpen@24'
sdlsrc/audio/winmm/SDL_winmm.c:331: undefined reference to `waveOutPrepareHeader@12'
projectdir\lib/libSDL2.a(SDL_winmm.c.obj): In function `PrepWaveFormat':
sdlsrc/audio/winmm/SDL_winmm.c:216: undefined reference to `waveOutOpen@24'
sdlsrc/audio/winmm/SDL_winmm.c:214: undefined reference to `waveInOpen@24'
projectdir\lib/libSDL2.a(SDL_winmm.c.obj): In function `WINMM_OpenDevice':
sdlsrc/audio/winmm/SDL_winmm.c:281: undefined reference to `waveInOpen@24'
projectdir\lib/libSDL2.a(SDL_winmm.c.obj): In function `DetectWaveInDevs':
sdlsrc/audio/winmm/SDL_winmm.c:57: undefined reference to `waveInGetNumDevs@0'
sdlsrc/audio/winmm/SDL_winmm.c:57: undefined reference to `waveInGetDevCapsW@12'
projectdir\lib/libSDL2.a(SDL_winmm.c.obj): In function `DetectWaveOutDevs':
sdlsrc/audio/winmm/SDL_winmm.c:56: undefined reference to `waveOutGetNumDevs@0'
sdlsrc/audio/winmm/SDL_winmm.c:56: undefined reference to `waveOutGetDevCapsW@12'
projectdir\lib/libSDL2.a(SDL_windowsframebuffer.c.obj): In function `WIN_CreateWindowFramebuffer':
sdlsrc/video/windows/SDL_windowsframebuffer.c:36: undefined reference to `DeleteDC@4'
sdlsrc/video/windows/SDL_windowsframebuffer.c:39: undefined reference to `DeleteObject@4'
sdlsrc/video/windows/SDL_windowsframebuffer.c:53: undefined reference to `CreateCompatibleBitmap@12'
sdlsrc/video/windows/SDL_windowsframebuffer.c:54: undefined reference to `GetDIBits@28'
sdlsrc/video/windows/SDL_windowsframebuffer.c:55: undefined reference to `GetDIBits@28'
sdlsrc/video/windows/SDL_windowsframebuffer.c:56: undefined reference to `DeleteObject@4'
sdlsrc/video/windows/SDL_windowsframebuffer.c:86: undefined reference to `CreateCompatibleDC@4'
sdlsrc/video/windows/SDL_windowsframebuffer.c:87: undefined reference to `CreateDIBSection@24'
sdlsrc/video/windows/SDL_windowsframebuffer.c:93: undefined reference to `SelectObject@8'
projectdir\lib/libSDL2.a(SDL_windowsframebuffer.c.obj): In function `WIN_UpdateWindowFramebuffer':
sdlsrc/video/windows/SDL_windowsframebuffer.c:102: undefined reference to `BitBlt@36'
projectdir\lib/libSDL2.a(SDL_windowsframebuffer.c.obj): In function `WIN_DestroyWindowFramebuffer':
sdlsrc/video/windows/SDL_windowsframebuffer.c:116: undefined reference to `DeleteDC@4'
sdlsrc/video/windows/SDL_windowsframebuffer.c:120: undefined reference to `DeleteObject@4'
projectdir\lib/libSDL2.a(SDL_windowsmodes.c.obj): In function `WIN_GetDisplayMode':
sdlsrc/video/windows/SDL_windowsmodes.c:108: undefined reference to `CreateDCW@16'
sdlsrc/video/windows/SDL_windowsmodes.c:112: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:113: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:153: undefined reference to `CreateCompatibleBitmap@12'
sdlsrc/video/windows/SDL_windowsmodes.c:154: undefined reference to `GetDIBits@28'
sdlsrc/video/windows/SDL_windowsmodes.c:155: undefined reference to `GetDIBits@28'
sdlsrc/video/windows/SDL_windowsmodes.c:156: undefined reference to `DeleteObject@4'
sdlsrc/video/windows/SDL_windowsmodes.c:157: undefined reference to `DeleteDC@4'
sdlsrc/video/windows/SDL_windowsmodes.c:137: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:138: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:145: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:144: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:108: undefined reference to `CreateDCW@16'
sdlsrc/video/windows/SDL_windowsmodes.c:112: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:113: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:153: undefined reference to `CreateCompatibleBitmap@12'
sdlsrc/video/windows/SDL_windowsmodes.c:154: undefined reference to `GetDIBits@28'
sdlsrc/video/windows/SDL_windowsmodes.c:155: undefined reference to `GetDIBits@28'
sdlsrc/video/windows/SDL_windowsmodes.c:156: undefined reference to `DeleteObject@4'
sdlsrc/video/windows/SDL_windowsmodes.c:157: undefined reference to `DeleteDC@4'
sdlsrc/video/windows/SDL_windowsmodes.c:137: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:138: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:145: undefined reference to `GetDeviceCaps@8'
sdlsrc/video/windows/SDL_windowsmodes.c:144: undefined reference to `GetDeviceCaps@8'
projectdir\lib/libSDL2.a(SDL_windowsopengl.c.obj): In function `WIN_GL_ChoosePixelFormatARB':
sdlsrc/video/windows/SDL_windowsopengl.c:446: undefined reference to `ChoosePixelFormat@8'
sdlsrc/video/windows/SDL_windowsopengl.c:446: undefined reference to `SetPixelFormat@12'
projectdir\lib/libSDL2.a(SDL_windowsopengl.c.obj): In function `WIN_GL_ChoosePixelFormat':
sdlsrc/video/windows/SDL_windowsopengl.c:208: undefined reference to `DescribePixelFormat@16'
sdlsrc/video/windows/SDL_windowsopengl.c:212: undefined reference to `DescribePixelFormat@16'
projectdir\lib/libSDL2.a(SDL_windowsopengl.c.obj): In function `WIN_GL_SetupWindowInternal':
sdlsrc/video/windows/SDL_windowsopengl.c:579: undefined reference to `SetPixelFormat@12'
projectdir\lib/libSDL2.a(SDL_windowsopengl.c.obj): In function `WIN_GL_InitExtensions':
sdlsrc/video/windows/SDL_windowsopengl.c:360: undefined reference to `ChoosePixelFormat@8'
sdlsrc/video/windows/SDL_windowsopengl.c:360: undefined reference to `SetPixelFormat@12'
projectdir\lib/libSDL2.a(SDL_windowsopengl.c.obj): In function `WIN_GL_SwapWindow':
sdlsrc/video/windows/SDL_windowsopengl.c:774: undefined reference to `SwapBuffers@4'
projectdir\lib/libSDL2.a(SDL_windowsopengl.c.obj): In function `WIN_GL_SetPixelFormatFrom':
sdlsrc/video/windows/SDL_windowsopengl.c:795: undefined reference to `GetPixelFormat@4'
sdlsrc/video/windows/SDL_windowsopengl.c:798: undefined reference to `DescribePixelFormat@16'
sdlsrc/video/windows/SDL_windowsopengl.c:801: undefined reference to `SetPixelFormat@12'
collect2.exe: error: ld returned 1 exit status

我怀疑也许我需要提供 Windows 库(我使用的是 Windows 10)?如果是这种情况,我需要哪些库以及在哪里可以找到它们?为什么当我使用 SDL2 的预构建版本时没有出现此问题?


如果使用静态 SDL 链接,则需要手动拉取它使用的所有库:

imagehlp dinput8 dxguid dxerr8 user32 gdi32 winmm imm32 ole32
oleaut32 shell32 version uuid

或者只使用动态 SDL2。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

我的项目中 SDL2 的链接器错误 的相关文章

随机推荐

  • Bootstrap 中心导航栏项目

    我知道我可以将导航栏项目向左和向右推送 但如何将它们居中呢 text align center 不起作用 也没有我想到的任何其他事情 您将需要修改导航栏组件的一些 CSS 规则 所以添加一个类center to nav navbar以及以下
  • Sql 视图的流畅 Nhibernate 映射

    我在 asp net mvc3 和 c 中使用 Fluent Nhibernate 我正在按以下方式工作来生成和映射一个类 Mapping using FluentNHibernate Mapping using Com Web Domai
  • 如何使用 Gradle 2.0 下载 javadoc 和 jar 源?

    我正在使用 Gradle 2 0 我应该写什么build gradle这样 javadocs 和源代码也会与 jar 一起下载吗 我猜您的问题与开发工作区有关 以下链接解释了如何使用 IDE 插件在 Gradle 中添加所需的配置 For
  • Android:使用 MotionEvent 在自定义 ViewGroup 中对视图进行拖放定位

    我在创建的自定义 ViewGroup 上定位视图元素时遇到问题 特别是在拖放情况下 我的目标是 Android 2 2 及更高版本 因此我无法真正使用 Android 3 中出现的拖放 API 我的自定义 ViewGroup 称为 Node
  • 如何一般性地比较整个java bean?

    我一直在尝试使用 org apache commons beanutils 库来获取方法 习惯用法来评估相等性all两个实例之间的属性 即 bean 的通用 equals 方法 有没有一种简单的方法可以使用这个库来做到这一点 或者我以错误的
  • MySQL - 将用户排在最高分列表中

    我有一个 MySQL 查询 它选择我的成绩中排名前 3 的球员users表 然后创建一个额外的列 其中分配了它们的排名 SELECT s curRank curRank 1 AS rank FROM users AS s JOIN SELE
  • 如何在 SQL 中更新/插入指定日期范围内的随机日期

    请原谅我 我是一个绝对的新手 我需要 phpmyadmin 中这张表的帮助 我的表有以下列 Primary ID Begin Date End Date Timestamp 如何在 phpmyadmin 中更新具有指定日期范围 例如 一个月
  • 在 C++ 纯虚函数上应用“using”关键字

    B 类重写了 A 类的纯虚函数 print C 类继承了 B 类并具有 using A print 语句 那么为什么 C 类不是抽象类呢 class A public virtual void print 0 class B public
  • 仅在多索引中的第二个索引上使用 .loc

    我有多索引数据框 如下所示 value year name 1921 Ah 40 1921 Ai 90 1922 Ah 100 1922 Ai 7 其中year and name是指数 我想选择名称所在的每一行Ai出现 我努力了df loc
  • 通用 C++ 多维迭代器

    在我当前的项目中 我正在处理多维数据结构 底层文件按顺序存储 即一个巨大的数组 没有向量的向量 使用这些数据结构的算法需要知道各个维度的大小 我想知道是否已在某处以通用方式定义了多维迭代器类 以及是否有任何标准或首选方法来解决此问题 目前
  • 如何在 Kendo 菜单中检索 id 值

    我在我的项目中使用 Kendo 菜单 我想在单击所选项目时检索 id 值 我使用了 onSelect 事件 并且能够检索所选项目的文本 如何检索 id 值 您可以使用 HTML5 数据属性来完成此操作 HTML div class k co
  • python多处理池解释器中的断言错误

    我正在编写一个示例程序来测试 python 2 7 2 中工作线程多处理池的使用情况 这是我在 python ubuntu 解释器中编写的代码 gt gt gt from multiprocessing import Pool gt gt
  • Swift:guard let 和 where - 优先级

    有时 我想用guard结合let where简化我的代码 但我想知道 let 的优先级是什么以及在哪里 例如 class Person func check gt Bool print checking return nil func te
  • 无可用服务器时的 Serilog 和 seq

    当使用 Serilog 和 Seq 的应用程序找不到将日志发送到的服务器时 预期的行为是什么 每次尝试记录都会抛出异常吗 我希望我的应用程序使用 Seq 服务器 如果可用 但如果不可用 仍继续运行并记录到文件 当使用 Serilog 和 S
  • 为什么 Pry 不能在 Heroku 的控制台中运行?

    我的目标是使用 Pry 作为我的 Rails 应用程序的控制台 无论是在本地还是在我的临时服务器上 但我无法让它在 Heroku 上工作 我正在跟进these https github com pry pry wiki Setting up
  • 如何从 Xcode 项目中删除 cocoa pods 插件之一

    有人知道如何从 Xcode 项目中删除 cocoa pods 插件之一吗 例如我已经安装了afnetworking and nyximagekit在我的项目中 现在 我想删除nyximagekit但保留afnetwoking 怎么做 从 p
  • 为什么在 Fortran 中使用命令 PRINT 会覆盖输入文件?

    我正在编写代码并使用 Fortran 中的输入和输出功能 代码看起来像这样 仅用于简化 PROGRAM TEST REAL DIMENSION 1000 A REAL B INTEGER T Defining input and outpu
  • 获取文件系统限制

    我想编写一个函数来告诉我是否可以将文件 文件夹写入特定路径 我想这样做而不实际将任何文件写入磁盘 有 WINAPI 函数吗 感谢您的帮助 您可以使用获取文件安全性 http msdn microsoft com en us library
  • opencv rtsp流协议

    我想处理并显示从树莓派相机创建的网络 rtsp 流 我有这个代码 include
  • 我的项目中 SDL2 的链接器错误

    我使用 CMake 和 Code Blocks 从源代码构建 SDL2 并尝试将我自己的项目源链接到以下静态库 libSDL2 a libSDL2main a OpenGL32 lib 这三个库包含在称为 libdir 我使用批处理命令 我