• 13
• 15
• 27
• 9
• 9

# Building Libraries (for SDL)

This topic is 4574 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello. I'm a beginner working with SDL. I recently added a few threads to get some help with loading images into my sprite class. Well, I have a new question. :-P I'm trying to create an isometric game, but I don't want to use sprites for the tiles. Instead, I want to draw the tiles using polygons. I've found several libraries for SDL that seem to make drawing polygons a snap... but I have no idea how to use them! I'm using Code::Blocks and the GNU GCC Compiler, so I can't use any of the DSP files that come with the packages to build the libraries. How can I go about doing this? All I need are the library files and the headers, but I have no idea how to make them! Any help is very appreciated. Thanks in advance. :-)

##### Share on other sites
If you mentioned what libraries you are trying to get built, it might be a bit easier to help you.

##### Share on other sites
I'm looking at two libraries, actually.

One is called SDL_gfx. http://www.ferzkopp.net/~aschiffler/Software/SDL_gfx-2.0/

The other is called SDL_draw. http://sdl-draw.sourceforge.net/

SDL_gfx seems more favorable. It has support for alpha blending at high speed with hardware acceleration and anti-aliasing certain primitives like lines and circles.

Does that help...?

Thanks for the quick reply, by the way. :-)

##### Share on other sites
Step by step

* File->New Project
* Dynamic Link Library, "Do not create any files"
* Right click on "DLL Sample" on the left bottom pane, select add files and select all the .h/.c files for SDL_Gfx (i just copied them all to a new folder where I made this project at)
* Hit Ctrl+F11 and Yes to build everything

Your library should now be made. Of course you will get a lot of messages:
Project   : DLL SampleCompiler  : GNU GCC Compiler (called directly)Directory : C:\Documents and Settings\Drew Benton\Desktop\SDL_gfx--------------------------------------------------------------------------------Switching to target: defaultCompiling: SDL_gfxPrimitives.cCompiling: SDL_imageFilter.cCompiling: SDL_rotozoom.cCompiling: SDL_framerate.cLinking dynamic library: sample.dllCreating library file: libsample.a.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1fc): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x252): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x2be): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x34c): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x5e6): undefined reference to SDL_MapRGB'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0xb09): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0xb6b): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0xbbf): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0xc37): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0xe8a): undefined reference to SDL_MapRGB'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x13ce): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1430): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1494): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1650): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x17f9): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x192b): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1b4c): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1b5a): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1c8c): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1ee3): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1ef1): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x1ff3): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x2a3d): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x2a4b): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x2c13): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x2f1e): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x2f80): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x32fa): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x357c): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x37cc): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x3ab9): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x3b1b): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x3e42): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x4184): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x49ea): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x4a5e): undefined reference to SDL_MapRGBA'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x58d5): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x5c3b): undefined reference to SDL_LockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x6373): undefined reference to SDL_UnlockSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x7ea3): undefined reference to SDL_FreeSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x805c): undefined reference to SDL_CreateRGBSurface'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x80cb): undefined reference to SDL_SetAlpha'.objs\SDL_gfxPrimitives.o:SDL_gfxPrimitives.c:(.text+0x81a5): undefined reference to SDL_UpperBlit'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x1b7e): undefined reference to SDL_CreateRGBSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x1ba3): undefined reference to SDL_UpperBlit'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x1d54): undefined reference to SDL_CreateRGBSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x1d9b): undefined reference to SDL_CreateRGBSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x1da9): undefined reference to SDL_LockSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x1e5f): undefined reference to SDL_SetAlpha'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x1f5b): undefined reference to SDL_SetColorKey'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x1f66): undefined reference to SDL_UnlockSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x2002): undefined reference to SDL_CreateRGBSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x2049): undefined reference to SDL_CreateRGBSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x2057): undefined reference to SDL_LockSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x20a5): undefined reference to SDL_SetAlpha'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x2151): undefined reference to SDL_SetColorKey'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x215c): undefined reference to SDL_UnlockSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x2170): undefined reference to SDL_FreeSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x22b2): undefined reference to SDL_CreateRGBSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x22d7): undefined reference to SDL_UpperBlit'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x23c0): undefined reference to SDL_CreateRGBSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x2407): undefined reference to SDL_CreateRGBSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x2415): undefined reference to SDL_LockSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x245d): undefined reference to SDL_SetAlpha'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x2503): undefined reference to SDL_SetColorKey'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x250e): undefined reference to SDL_UnlockSurface'.objs\SDL_rotozoom.o:SDL_rotozoom.c:(.text+0x251f): undefined reference to SDL_FreeSurface'.objs\SDL_framerate.o:SDL_framerate.c:(.text+0x29): undefined reference to SDL_GetTicks'.objs\SDL_framerate.o:SDL_framerate.c:(.text+0xb3): undefined reference to SDL_GetTicks'.objs\SDL_framerate.o:SDL_framerate.c:(.text+0x114): undefined reference to SDL_Delay'.objs\SDL_framerate.o:SDL_framerate.c:(.text+0x127): undefined reference to SDL_GetTicks'collect2: ld returned 1 exit statusProcess terminated with status 1 (0 minutes, 2 seconds)0 errors, 0 warnings 

Because the input libraries were not specified. If you click on Project->Build Options->Linker options tab, you will need to add in the .a file for the "libSDL.dll.a" file (SDL 1.2.9) and you will now get
Project   : DLL SampleCompiler  : GNU GCC Compiler (called directly)Directory : C:\Documents and Settings\Drew Benton\Desktop\SDL_gfx--------------------------------------------------------------------------------Switching to target: defaultCompiling: SDL_gfxPrimitives.cCompiling: SDL_imageFilter.cCompiling: SDL_rotozoom.cCompiling: SDL_framerate.cLinking dynamic library: sample.dllCreating library file: libsample.aProcess terminated with status 0 (0 minutes, 1 seconds)0 errors, 0 warnings`

That's it! No project file needed, good luck. Let us know if you run into troubles. Just make sure you have added in the directories to the compiler for the SDL library.