hello!
i am using image=IMG_Load(file) to load png, in code where image is
previously declared :
SDL_Surface *image;
image=SDL_LoadBMP(file)
compiler throws warning:
assignment makes pointer from integer without a cast
makefile :
CFLAGS = $(shell sdl-config --cflags)
LIBS = $(shell sdl-config --libs) -lm -lSDL_image
transparent: transparent.o
$(CC) -o $@ $< $(LIBS)
any idea if i should just ignore the warning ?
thanks++++++++++++++++++++++++
Try:
SDL_Surface *image;
image = (SDL_Surface *)malloc(sizeof(SDL_Surface));
image = SDL_LoadBMP(file)On Tue, 2004-03-02 at 13:48 +0100, Ales Zemene wrote:
hello!
i am using image=IMG_Load(file) to load png, in code where image is
previously declared :
SDL_Surface *image;
image=SDL_LoadBMP(file)
compiler throws warning:
assignment makes pointer from integer without a cast
makefile :
CFLAGS = $(shell sdl-config --cflags)
LIBS = $(shell sdl-config --libs) -lm -lSDL_image
transparent: transparent.o
$(CC) -o $@ $< $(LIBS)
any idea if i should just ignore the warning ?
thanks
++++++++++++++++++++++++
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Never mind that last reply, SDL_LoadBMP probably returns a pointer
anyway ;0
Are you including SDL_image, which has the prototype of IMG_Load?
If you don’t, and you are compiling C source (not C++), the compiler
assumes any undeclared function returns int.
Ing. Gabriel Gambetta
ARTech - GeneXus Development Team
ggambett at artech.com.uy> ----- Original Message -----
From: Ales Zemene [mailto:ales@mur.at]
Sent: Martes, 02 de Marzo de 2004 09:49 a.m.
To: sdl at libsdl.org
Subject: [SDL] IMG_Load() warning
hello!
i am using image=IMG_Load(file) to load png, in code where image is
previously declared :
SDL_Surface *image;
image=SDL_LoadBMP(file)
compiler throws warning:
assignment makes pointer from integer without a cast
makefile :
CFLAGS = $(shell sdl-config --cflags)
LIBS = $(shell sdl-config --libs) -lm -lSDL_image
transparent: transparent.o
$(CC) -o $@ $< $(LIBS)
any idea if i should just ignore the warning ?
thanks
++++++++++++++++++++++++
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Did you include “SDL_image.h”?
At 01:48 PM 3/2/2004 +0100, Ales Zemene wrote:>i am using image=IMG_Load(file) to load png, in code where image is
previously declared :
SDL_Surface *image;
image=SDL_LoadBMP(file)
compiler throws warning:
assignment makes pointer from integer without a cast
it works :
sorry i did not make it obvious enough before, i was trying to avoid
SDL_LoadBMP(file) ,
and i am using
IMG_Load(file)
and yes, i have added:
include <SDL/SDL_image.h>
–
–SDL_Surface *prep_image(char *file)
– SDL_Surface *image;
– image = (SDL_Surface *)malloc(sizeof(SDL_Surface));
– image = IMG_Load(file);
– if ( image == NULL )
– fprintf(stderr, “Couldn’t load %s: %s\n”, file, SDL_GetError());
– return(NULL);
– return(image);
–
thanks++++++++++++++++++++++++
– SDL_Surface *image;
– image = (SDL_Surface *)malloc(sizeof(SDL_Surface));
– image = IMG_Load(file);
The second line is redundant anyway.
Ing. Gabriel Gambetta
ARTech - GeneXus Development Team
ggambett at artech.com.uy
Worse, actually; it’s a memory leak.
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
— http://olofson.net — http://www.reologica.se —On Wednesday 03 March 2004 14.15, Gabriel Gambetta wrote:
– SDL_Surface *image;
– image = (SDL_Surface *)malloc(sizeof(SDL_Surface));
– image = IMG_Load(file);
The second line is redundant anyway.
naja you were right, without malloc is life easier.
thanks againOn Wednesday 03 March 2004 14.15, Gabriel Gambetta wrote:
– SDL_Surface *image;
– image = (SDL_Surface *)malloc(sizeof(SDL_Surface));
– image = IMG_Load(file);
The second line is redundant anyway.
Worse, actually; it’s a memory leak.
++++++++++++++++++++++++