您如何在 cross-compiling 时从 ubuntu link 到 windows 系统 .dll? (使用代码块)
How do you link to windows system .dlls from ubuntu while cross-compiling? (Using codeblocks)
我已经设置了一个 mingw cross-compiler (i686-w64-mingw32) 以使用代码块 IDE 在 ubuntu 上编译一个 windows .exe。我的 "hello world" 测试表明这是有效的。我现在正在尝试 cross-compile 我的完整应用程序,它静态地 links 到许多 SDL2 库。我面临这个错误列表:
||=== Build: Windows in MyAppSDL (compiler: Windows X-Compile MinGW 32) ===|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|58|undefined reference to `_imp__timeBeginPeriod@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|58|undefined reference to `_imp__timeBeginPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_TicksInit':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|106|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_GetTicks_REAL':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|159|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|58|undefined reference to `_imp__timeBeginPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_TicksInit':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|106|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_GetTicks_REAL':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|159|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|58|undefined reference to `_imp__timeBeginPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_TicksInit':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|106|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windows.o)||In function `WIN_CoInitialize':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/core/windows/SDL_windows.c|68|undefined reference to `_imp__CoInitializeEx@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windows.o)||In function `WIN_CoUninitialize':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/core/windows/SDL_windows.c|87|undefined reference to `_imp__CoUninitialize@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowsmouse.o)||In function `WIN_CreateCursor':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowsmouse.c|91|undefined reference to `_imp__CreateDIBSection@24'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowsmouse.c|92|undefined reference to `_imp__CreateBitmap@20'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowsmouse.c|102|undefined reference to `_imp__DeleteObject@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_SetupAPI':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|596|undefined reference to `ImmGetIMEFileNameA@12'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|609|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|612|undefined reference to `ImmReleaseContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_GetId':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|530|undefined reference to `ImmGetIMEFileNameA@12'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|545|undefined reference to `GetFileVersionInfoSizeA@8'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|549|undefined reference to `GetFileVersionInfoA@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|550|undefined reference to `VerQueryValueA@16'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `UILess_GetCandidateList':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|966|undefined reference to `_imp__SysFreeString@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_ClearComposition':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|662|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|666|undefined reference to `ImmNotifyIME@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|670|undefined reference to `ImmNotifyIME@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|671|undefined reference to `ImmReleaseContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_Disable':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|344|undefined reference to `ImmAssociateContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_ClearComposition':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|668|undefined reference to `ImmSetCompositionStringW@24'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|662|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|666|undefined reference to `ImmNotifyIME@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|670|undefined reference to `ImmNotifyIME@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|671|undefined reference to `ImmReleaseContext@8'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|668|undefined reference to `ImmSetCompositionStringW@24'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `UIElementSink_BeginUIElement@12':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|1033|undefined reference to `_imp__SysFreeString@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `UIElementSink_UpdateUIElement@8':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|1060|undefined reference to `_imp__SysFreeString@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_Init':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|289|undefined reference to `_imp__CoCreateInstance@20'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|303|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|304|undefined reference to `ImmReleaseContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `UILess_SetupSinks':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|1174|undefined reference to `_imp__CoCreateInstance@20'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_GetId':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|530|undefined reference to `ImmGetIMEFileNameA@12'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|545|undefined reference to `GetFileVersionInfoSizeA@8'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|549|undefined reference to `GetFileVersionInfoA@16'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_GetReadingString':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|402|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|477|undefined reference to `ImmReleaseContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_GetId':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|550|undefined reference to `VerQueryValueA@16'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 10 second(s)) ===|
我做了一些研究,据我所知,这是因为 SDL2 想要动态地 link 某些 windows 系统库。我还收集到 mingw 或 SDL2 都带有解决这些问题的资源,但我无法弄清楚这些是什么或在哪里。虽然有些资源似乎可以解决问题,但我永远无法完全理解实际的解决方案是什么。以下是我在 Whosebug 上找到的一小部分我认为相关的资源:
wxWidgets how to cross compile an application for windows from linux using codeblocks?
第一个 link 列出了 SDL2 想要 link 的 .dll。然而,该解决方案没有向他们提及如何 link 。我在我的 windows 机器上找到了所有这些库,我天真地尝试将它们放在我的项目文件夹中并动态地 link 它们,但是 ubuntu 无法识别 .dll。
第二个 link 是关于 cross-compiling windows 的 wxWidgets 应用程序,来自 ubuntu,使用代码块 IDE。我对解决方案中的几行特别感兴趣。他们考虑设置编译器。
Compiler Settings > Other Options : `/usr/local/i586-mingw32/bin/wx-config --cxxflags`
Linker Settings > Other Options : `/usr/local/i586-mingw32/bin/wx-config --libs`
这是该解决方案的编译器设置中唯一与我自己的编译器设置不同的部分。我在这两个 "Other Options" 部分中都没有。显然,特定的 filepaths/filenames 具体与 wxWidgets 相关,但我想知道我是否需要为我的 SDL2 库找到一些类似的文件?我有一个关于文件系统的 scout,但没有运气。
第三个 link 讨论 linking 到一个 .dll,首先在 mingw 中 cross-compiling 它。我不理解那里的所有说明,也许是因为我的生活被 IDE 糖衣包裹并且从未处理过编译程序的 nitty-gritty,无论如何,我相当确定这一点资源是相关的。
任何帮助将不胜感激!
皮特
好的,所以我今天设法从 Ubuntu.
为 Windows 交叉编译了依赖于 SDL2 的应用程序
我的第一个错误是尝试静态 link 到 SDL2 windows 库 (.lib)。我需要做的是 link 到 .dll.a 文件进行编译。这些在 mingw 文件夹中随 SDL2 一起提供。这些文件夹是:
i686-w64-mingw32 用于 32 位库
x86_64-w64-mingw32 64 位库
然后在我真正让它工作之前,我遇到了许多其他错误。我在另一个 post:
的回答中列出了我为解决这些问题所采取的步骤
SDL doesn't compile in native enviroment
我已经设置了一个 mingw cross-compiler (i686-w64-mingw32) 以使用代码块 IDE 在 ubuntu 上编译一个 windows .exe。我的 "hello world" 测试表明这是有效的。我现在正在尝试 cross-compile 我的完整应用程序,它静态地 links 到许多 SDL2 库。我面临这个错误列表:
||=== Build: Windows in MyAppSDL (compiler: Windows X-Compile MinGW 32) ===|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|58|undefined reference to `_imp__timeBeginPeriod@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|58|undefined reference to `_imp__timeBeginPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_TicksInit':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|106|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_GetTicks_REAL':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|159|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|58|undefined reference to `_imp__timeBeginPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_TicksInit':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|106|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_GetTicks_REAL':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|159|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|58|undefined reference to `_imp__timeBeginPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `SDL_TicksInit':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|106|undefined reference to `_imp__timeGetTime@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_systimer.o)||In function `timeSetPeriod':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/timer/windows/SDL_systimer.c|52|undefined reference to `_imp__timeEndPeriod@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windows.o)||In function `WIN_CoInitialize':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/core/windows/SDL_windows.c|68|undefined reference to `_imp__CoInitializeEx@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windows.o)||In function `WIN_CoUninitialize':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/core/windows/SDL_windows.c|87|undefined reference to `_imp__CoUninitialize@0'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowsmouse.o)||In function `WIN_CreateCursor':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowsmouse.c|91|undefined reference to `_imp__CreateDIBSection@24'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowsmouse.c|92|undefined reference to `_imp__CreateBitmap@20'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowsmouse.c|102|undefined reference to `_imp__DeleteObject@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_SetupAPI':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|596|undefined reference to `ImmGetIMEFileNameA@12'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|609|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|612|undefined reference to `ImmReleaseContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_GetId':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|530|undefined reference to `ImmGetIMEFileNameA@12'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|545|undefined reference to `GetFileVersionInfoSizeA@8'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|549|undefined reference to `GetFileVersionInfoA@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|550|undefined reference to `VerQueryValueA@16'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `UILess_GetCandidateList':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|966|undefined reference to `_imp__SysFreeString@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_ClearComposition':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|662|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|666|undefined reference to `ImmNotifyIME@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|670|undefined reference to `ImmNotifyIME@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|671|undefined reference to `ImmReleaseContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_Disable':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|344|undefined reference to `ImmAssociateContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_ClearComposition':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|668|undefined reference to `ImmSetCompositionStringW@24'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|662|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|666|undefined reference to `ImmNotifyIME@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|670|undefined reference to `ImmNotifyIME@16'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|671|undefined reference to `ImmReleaseContext@8'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|668|undefined reference to `ImmSetCompositionStringW@24'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `UIElementSink_BeginUIElement@12':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|1033|undefined reference to `_imp__SysFreeString@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `UIElementSink_UpdateUIElement@8':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|1060|undefined reference to `_imp__SysFreeString@4'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_Init':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|289|undefined reference to `_imp__CoCreateInstance@20'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|303|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|304|undefined reference to `ImmReleaseContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `UILess_SetupSinks':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|1174|undefined reference to `_imp__CoCreateInstance@20'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_GetId':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|530|undefined reference to `ImmGetIMEFileNameA@12'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|545|undefined reference to `GetFileVersionInfoSizeA@8'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|549|undefined reference to `GetFileVersionInfoA@16'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_GetReadingString':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|402|undefined reference to `ImmGetContext@4'|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|477|undefined reference to `ImmReleaseContext@8'|
windowsLibs/SDL2x86/lib/libSDL2.a(SDL_windowskeyboard.o)||In function `IME_GetId':|
/Users/slouken/release/SDL/SDL2-2.0.3-source/foo-x86/../src/video/windows/SDL_windowskeyboard.c|550|undefined reference to `VerQueryValueA@16'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 10 second(s)) ===|
我做了一些研究,据我所知,这是因为 SDL2 想要动态地 link 某些 windows 系统库。我还收集到 mingw 或 SDL2 都带有解决这些问题的资源,但我无法弄清楚这些是什么或在哪里。虽然有些资源似乎可以解决问题,但我永远无法完全理解实际的解决方案是什么。以下是我在 Whosebug 上找到的一小部分我认为相关的资源:
第一个 link 列出了 SDL2 想要 link 的 .dll。然而,该解决方案没有向他们提及如何 link 。我在我的 windows 机器上找到了所有这些库,我天真地尝试将它们放在我的项目文件夹中并动态地 link 它们,但是 ubuntu 无法识别 .dll。
第二个 link 是关于 cross-compiling windows 的 wxWidgets 应用程序,来自 ubuntu,使用代码块 IDE。我对解决方案中的几行特别感兴趣。他们考虑设置编译器。
Compiler Settings > Other Options : `/usr/local/i586-mingw32/bin/wx-config --cxxflags`
Linker Settings > Other Options : `/usr/local/i586-mingw32/bin/wx-config --libs`
这是该解决方案的编译器设置中唯一与我自己的编译器设置不同的部分。我在这两个 "Other Options" 部分中都没有。显然,特定的 filepaths/filenames 具体与 wxWidgets 相关,但我想知道我是否需要为我的 SDL2 库找到一些类似的文件?我有一个关于文件系统的 scout,但没有运气。
第三个 link 讨论 linking 到一个 .dll,首先在 mingw 中 cross-compiling 它。我不理解那里的所有说明,也许是因为我的生活被 IDE 糖衣包裹并且从未处理过编译程序的 nitty-gritty,无论如何,我相当确定这一点资源是相关的。
任何帮助将不胜感激!
皮特
好的,所以我今天设法从 Ubuntu.
为 Windows 交叉编译了依赖于 SDL2 的应用程序我的第一个错误是尝试静态 link 到 SDL2 windows 库 (.lib)。我需要做的是 link 到 .dll.a 文件进行编译。这些在 mingw 文件夹中随 SDL2 一起提供。这些文件夹是:
i686-w64-mingw32 用于 32 位库 x86_64-w64-mingw32 64 位库
然后在我真正让它工作之前,我遇到了许多其他错误。我在另一个 post:
的回答中列出了我为解决这些问题所采取的步骤SDL doesn't compile in native enviroment