Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDL 1.3/2.0 setting up

I have been using sdl 1.2 for the past several months(On windows).I am thinking about migrating to 1.3. So I used cmake and codeblocks to create the static and dynamic libray.now I am confused how to compile the a program.I included the sdl.h header..added the static library in the linker.But when I try to compile lots of undefined errors keep occuring:

D:\using font\sdl_2test\main.c||In function 'SDL_main':|
D:\using font\sdl_2test\main.c|9|warning: passing argument 6 of 'SDL_CreateWindow' makes integer from pointer without a cast|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\include\SDL_video.h|405|note: expected 'Uint32' but argument is of type 'void *'|
D:\using font\sdl_2test\main.c|11|warning: control reaches end of non-void function|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowsmodes.c.obj)||In function `WIN_GetDisplayMode':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsmodes.c|62|undefined reference to `CreateDCW@16'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsmodes.c|71|undefined reference to `CreateCompatibleBitmap@12'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsmodes.c|72|undefined reference to `GetDIBits@28'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsmodes.c|73|undefined reference to `GetDIBits@28'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsmodes.c|74|undefined reference to `DeleteObject@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsmodes.c|75|undefined reference to `DeleteDC@4'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowswindow.c.obj)||In function `WIN_GetWindowGammaRamp':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowswindow.c|530|undefined reference to `CreateDCW@16'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowswindow.c|532|undefined reference to `GetDeviceGammaRamp@8'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowswindow.c|536|undefined reference to `DeleteDC@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowswindow.c|536|undefined reference to `DeleteDC@4'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowswindow.c.obj)||In function `WIN_SetWindowGammaRamp':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowswindow.c|511|undefined reference to `CreateDCW@16'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowswindow.c|513|undefined reference to `SetDeviceGammaRamp@8'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowswindow.c|517|undefined reference to `DeleteDC@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowswindow.c|517|undefined reference to `DeleteDC@4'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowsframebuffer.c.obj)||In function `WIN_DestroyWindowFramebuffer':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|114|undefined reference to `DeleteDC@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|118|undefined reference to `DeleteObject@4'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowsframebuffer.c.obj)||In function `WIN_UpdateWindowFramebuffer':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|100|undefined reference to `BitBlt@36'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowsframebuffer.c.obj)||In function `WIN_CreateWindowFramebuffer':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|36|undefined reference to `DeleteDC@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|39|undefined reference to `DeleteObject@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|50|undefined reference to `CreateCompatibleBitmap@12'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|51|undefined reference to `GetDIBits@28'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|52|undefined reference to `GetDIBits@28'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|53|undefined reference to `DeleteObject@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|83|undefined reference to `CreateCompatibleDC@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|84|undefined reference to `CreateDIBSection@24'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsframebuffer.c|91|undefined reference to `SelectObject@8'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowsshape.c.obj)||In function `CombineRectRegions':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsshape.c|53|undefined reference to `CreateRectRgn@16'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsshape.c|55|undefined reference to `CombineRgn@16'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsshape.c|56|undefined reference to `DeleteObject@4'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowsopengl.c.obj)||In function `WIN_GL_SwapWindow':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsopengl.c|668|undefined reference to `SwapBuffers@4'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowsopengl.c.obj)||In function `WIN_GL_ChoosePixelFormatARB':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsopengl.c|399|undefined reference to `ChoosePixelFormat@8'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsopengl.c|399|undefined reference to `SetPixelFormat@12'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowsopengl.c.obj)||In function `WIN_GL_SetupWindow':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsopengl.c|518|undefined reference to `SetPixelFormat@12'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowsopengl.c.obj)||In function `WIN_GL_ChoosePixelFormat':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsopengl.c|206|undefined reference to `DescribePixelFormat@16'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowsopengl.c|210|undefined reference to `DescribePixelFormat@16'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowskeyboard.c.obj)||In function `IPPASink_QueryInterface@12':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|1117|undefined reference to `IID_IUnknown'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowskeyboard.c.obj)||In function `UIElementSink_QueryInterface@12':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|1011|undefined reference to `IID_IUnknown'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowskeyboard.c.obj)||In function `IME_SetupAPI':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|613|undefined reference to `ImmGetIMEFileNameA@12'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|626|undefined reference to `ImmGetContext@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|629|undefined reference to `ImmReleaseContext@8'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowskeyboard.c.obj)||In function `IME_ClearComposition':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|679|undefined reference to `ImmGetContext@4'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|683|undefined reference to `ImmNotifyIME@16'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|687|undefined reference to `ImmNotifyIME@16'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|688|undefined reference to `ImmReleaseContext@8'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|685|undefined reference to `ImmSetCompositionStringW@24'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowskeyboard.c.obj)||In function `IME_GetCompositionString':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|695|undefined reference to `ImmGetCompositionStringW@16'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|700|undefined reference to `ImmGetCompositionStringW@16'|
..\..\GameDev\SDL_2\static\libSDL2.a(SDL_windowskeyboard.c.obj)||In function `IME_GetId':|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|547|undefined reference to `ImmGetIMEFileNameA@12'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|562|undefined reference to `GetFileVersionInfoSizeA@8'|
D:\GameDev\SDL-2.0\SDL-2.0.0-6799\src\video\windows\SDL_windowskeyboard.c|566|undefined reference to `GetFileVersionInfoA@16'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 2 warnings ===|

What am I missing? :/

like image 718
prithul Avatar asked Jan 14 '13 12:01

prithul


People also ask

How do I install SDL on Windows 10?

You can either put the dll file in the same directory as your executable, or put it in the system directory. C:\WINDOWS\SYSTEM32 is the 32bit windows system directory and C:\Windows\SysWOW64 is the 64bit system directory of 32bit applications.


1 Answers

I also was searching for an answer to this and, as I couldn't find one, here's what worked for me:

If using mingw as compiler, you have to link to the follow libraries in this order:

-lmingw32 -lSDL2main -lSDL2 -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid 
like image 88
superbem Avatar answered Sep 28 '22 10:09

superbem