NO

Author Topic: SDL_image  (Read 3719 times)

novalis

  • Guest
SDL_image
« on: August 20, 2010, 11:23:49 AM »
I have tried to use  SDL_image:
  so I have copied  the
 SDL_image.h  to  PellesC  include directory
 
 *.dll  form  SDL_image-1.2.10-win32.zip  to   bin directory

 all dll  have transformed to  lib   with polib (i.e. polib   SDL_image.dll  /OUT:SDL_image )
  and  have copied  *.lib  to  PellesC  lib  directory

 Then tried to build :

#include <SDL.h>
#include <SDL_image.h>
#include <windows.h>
#include <stdbool.h>
SDL_Surface *buffer = 0;
SDL_Surface *bitmap = 0;

int wmain(int argc, char *argv[])
{
    SDL_Init(SDL_INIT_VIDEO);

      IMG_Init(IMG_INIT_JPG);
               buffer = SDL_SetVideoMode(1280, 1024, 32, SDL_SWSURFACE|SDL_ANYFORMAT);
               bool run = true;
              SDL_Event event;

  bitmap = IMG_Load("test.jpg");
 
SDL_BlitSurface(bitmap, 0, buffer, 0);
SDL_UpdateRect(buffer, 0, 0, bitmap->w, bitmap->h);
   SDL_Flip(buffer);
    SDL_SaveBMP(bitmap,"test2.bmp");
    if(bitmap == 0){
        return -1;
    }

   
    while(run){
        while(SDL_PollEvent(&event)){
    
            if(event.type == SDL_QUIT)
            {
                run = false;
            }
        }
    }

 

    SDL_Quit();
    return(0);
}

but  the result was :
  POLINK: error: Unresolved external symbol '_IMG_Init'.
  POLINK: error: Unresolved external symbol '_IMG_Load'.
   POLINK: fatal error: 2 unresolved external(s).

Can anybody help?


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: SDL_image
« Reply #1 on: August 20, 2010, 02:43:03 PM »
From this package you find SDL_image.lib for MSVC and you can use it.
http://www.libsdl.org/projects/SDL_image/release/SDL_image-devel-1.2.10-VC.zip

Or do this:
polib /MACHINE:X86 /out:SDL_image.lib /def:SDL_image.def

SDL_image.def
Code: [Select]
LIBRARY SDL_image.dll
EXPORTS
IMG_Init @1 ;0001h
IMG_InvertAlpha @2 ;0002h
IMG_Linked_Version @3 ;0003h
IMG_Load @4 ;0004h
IMG_LoadBMP_RW @5 ;0005h
IMG_LoadCUR_RW @6 ;0006h
IMG_LoadGIF_RW @7 ;0007h
IMG_LoadICO_RW @8 ;0008h
IMG_LoadJPG_RW @9 ;0009h
IMG_LoadLBM_RW @10 ;000Ah
IMG_LoadPCX_RW @11 ;000Bh
IMG_LoadPNG_RW @12 ;000Ch
IMG_LoadPNM_RW @13 ;000Dh
IMG_LoadTGA_RW @14 ;000Eh
IMG_LoadTIF_RW @15 ;000Fh
IMG_LoadTyped_RW @16 ;0010h
IMG_LoadXCF_RW @17 ;0011h
IMG_LoadXPM_RW @18 ;0012h
IMG_LoadXV_RW @19 ;0013h
IMG_Load_RW @20 ;0014h
IMG_Quit @21 ;0015h
IMG_ReadXPMFromArray @22 ;0016h
IMG_isBMP @23 ;0017h
IMG_isCUR @24 ;0018h
IMG_isGIF @25 ;0019h
IMG_isICO @26 ;001Ah
IMG_isJPG @27 ;001Bh
IMG_isLBM @28 ;001Ch
IMG_isPCX @29 ;001Dh
IMG_isPNG @30 ;001Eh
IMG_isPNM @31 ;001Fh
IMG_isTIF @32 ;0020h
IMG_isXCF @33 ;0021h
IMG_isXPM @34 ;0022h
IMG_isXV @35 ;0023h
May the source be with you

novalis

  • Guest
Re: SDL_image
« Reply #2 on: August 20, 2010, 05:13:40 PM »
 It works beautifully   -  thanks  a  lot  :) :) :)