SDL - Dev-Cpp/Win32 and SDL_image

Hi out there. I am about to go nuts any time here. I have tried on
google and on diff websites to get the clearest info on setting a thing
up for me.

I have a SDL program that is constructed to load PNG-images with help
from SDL_image, right?

On my linux setup everything works fine, but on Dev-Cpp/MingWin with
SDL+SDL_image I dont get the PNG files to load. Isn’t SDL_image
pre-compiled to load PNG:s in Dev-Cpp?

Issue is this:
IMG_Load(bmp_file) works allright, but:
IMG_Load(png_file) makes the SDL parashute on me.

I have linked agains with:

gcc png.c -o png -lmingw32 -lz -lpng -lSDL -lSDLmain -lSDL_image

and Dev-Cpp does everything allright. I build my .exe-file without any
complains at all!

I need to load png-files coz my whole linux-project depends on it, and
it’s a whole lot of work not just converting to BMP format if you know
what I mean. :slight_smile: So I am hoping for some small hints, if any in here.

Waiting for game no. uno (Nwn)–
Patrich Bj?rklund <@Patrich_Bjorklund>
Home Factory

On my linux setup everything works fine, but on Dev-Cpp/MingWin with
SDL+SDL_image I dont get the PNG files to load. Isn’t SDL_image
pre-compiled to load PNG:s in Dev-Cpp?

Make sure libpng1.dll is in your path.

Stanley,
Try build the library Im your local environment but use this DLLS:
http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.3-win32.zip.
It seems a GCC bug.
With me work fine in cygwin.

Alcionei Estevam Jr.Em 12 Mar 2003, sdl at libsdl.org escreveu:

On my linux setup everything works fine, but on Dev-Cpp/MingWin with
SDL+SDL_image I dont get the PNG files to load. Isn’t SDL_image
pre-compiled to load PNG:s in Dev-Cpp?

Make sure libpng1.dll is in your path.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl



Voce quer um iGMail protegido contra v?rus e spams?
Clique aqui: http://www.igmailseguro.ig.com.br

Stanley,
Try build the library Im your local environment but use this DLLS:
http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.3-win32.zip.

???

Are you responding to my suggestion for Patrich Bj?rklund to check for
libpng1.dll in his path?

Sory Stanley… The answer is to Patrich Bj?rklund…Em 12 Mar 2003, sdl at libsdl.org escreveu:

Stanley,
Try build the library Im your local environment but use this DLLS:
http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.3-win32.zip.

???

Are you responding to my suggestion for Patrich Bj?rklund to check for
libpng1.dll in his path?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl



Voce quer um iGMail protegido contra v?rus e spams?
Clique aqui: http://www.igmailseguro.ig.com.br

Hi all!
I do have libpng.dll, libpng1.dll, libpng10.dll and libpng12.dll, zlib.dll all in my paths. (Dev-Cpp\Dll + WINNT\System32).
Also do I have libpng.a, libpng1.a, libpng10.a and libpng12.a in my Dev-Cpp\lib cat.

The gcc I have is: 2.95.3-6 (mingw special)

Any more tips? Do you guys having png-files working with SDL_image?
/Patrich

Stanley Brown wrote …> >

Stanley,
Try build the library Im your local environment but use this DLLS:
http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.3-win32.zip.

???

Are you responding to my suggestion for Patrich Bj?rklund to check for
libpng1.dll in his path?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Thanks for that dll set Stanley, but unfortunately my prog bombed on me again. The simple test code I am using goes like this:-----------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>

int main( int argc, char *argv[] )
{

SDL_Surface * scr;
SDL_Surface * img;
SDL_Rect pic;

if ( (SDL_Init ( SDL_INIT_VIDEO ) < 0) ) {
fprintf(stderr, “Can’t init video: %s”, SDL_GetError());
exit(1);
}

scr = SDL_SetVideoMode (640,480,32, SDL_SWSURFACE);
if(scr == NULL ) {
fprintf(stderr, “Cant init screen: %s”, SDL_GetError());
exit(1);
}
atexit ( SDL_Quit () );
//img = IMG_Load(“pic2/Bubblor.bmp”); //THIS WORKS OK.
fprintf (stderr, “loading PNG-graphic…\n”);
img = IMG_Load(“pic/item_chart.png”); //!!! HERE SDL Parachutes!!!
if (img == 0 ) {
fprintf(stderr, “NOT loading image OK (path-error?..\n”);
}

fprintf (stderr, “PNG-file loaded successfully…\n”);
pic.x = 0; pic.y = 0;
pic.w = img->w; pic.h = img->h;

SDL_BlitSurface ( img, NULL, scr, &pic);
SDL_UpdateRect (scr,0,0,0,0);
SDL_FreeSurface(img);
SDL_Delay(3000);
SDL_Quit();
fprintf (stderr,“SDL fungerade utan fel.”);
return 0;
}

stderr.txt says:

loading PNG-graphic…
Fatal signal: Segmentation Fault (SDL Parachute Deployed)

/Patrich
Stanley Brown wrote …

Stanley,
Try build the library Im your local environment but use this DLLS:
http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.3-win32.zip.

???

Are you responding to my suggestion for Patrich Bj?rklund to check for
libpng1.dll in his path?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Patrich,

Try to make what I say. Its work for me to identic error.
If don’t work, I send my library for you (built in cygwin).

Alcionei Estevam Jr.Em 13 Mar 2003, sdl at libsdl.org escreveu:

Thanks for that dll set Stanley, but unfortunately my prog bombed on me
again. The simple test code I am using goes like this:


#include
#include
#include
#include

int main( int argc, char *argv[] )
{

SDL_Surface * scr;
SDL_Surface * img;
SDL_Rect pic;

if ( (SDL_Init ( SDL_INIT_VIDEO ) < 0) ) {
fprintf(stderr, “Can’t init video: %s”, SDL_GetError());
exit(1);
}

scr = SDL_SetVideoMode (640,480,32, SDL_SWSURFACE);
if(scr == NULL ) {
fprintf(stderr, “Cant init screen: %s”, SDL_GetError());
exit(1);
}
atexit ( SDL_Quit () );
//img = IMG_Load(“pic2/Bubblor.bmp”); //THIS WORKS OK.
fprintf (stderr, “loading PNG-graphic…\n”);
img = IMG_Load(“pic/item_chart.png”); //!!! HERE SDL Parachutes!!!
if (img == 0 ) {
fprintf(stderr, “NOT loading image OK (path-error?..\n”);
}

fprintf (stderr, “PNG-file loaded successfully…\n”);
pic.x = 0; pic.y = 0;
pic.w = img->w; pic.h = img->h;

SDL_BlitSurface ( img, NULL, scr, &pic);
SDL_UpdateRect (scr,0,0,0,0);
SDL_FreeSurface(img);
SDL_Delay(3000);
SDL_Quit();
fprintf (stderr,“SDL fungerade utan fel.”);
return 0;
}

stderr.txt says:

loading PNG-graphic…
Fatal signal: Segmentation Fault (SDL Parachute Deployed)

/Patrich
Stanley Brown wrote …

Stanley,
Try build the library Im your local environment but use this DLLS:

http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.3-win32.zip.

???

Are you responding to my suggestion for Patrich Bj?rklund to check for
libpng1.dll in his path?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl



Voce quer um iGMail protegido contra v?rus e spams?
Clique aqui: http://www.igmailseguro.ig.com.br

Hi all!
I do have libpng.dll, libpng1.dll, libpng10.dll and libpng12.dll, zlib.dll all in my paths. (Dev-Cpp\Dll + WINNT\System32).
Also do I have libpng.a, libpng1.a, libpng10.a and libpng12.a in my Dev-Cpp\lib cat.

I should have read your email more closely earlier:

gcc png.c -o png -lmingw32 -lz -lpng -lSDL -lSDLmain -lSDL_image

You shouldnt have to link the png libs since SDL_image is already compiled against it. This should work:

gcc -mwindows -o png png.c -lmingw32 -lSDLmain -lSDL -lSDL_image

I compiled your code and it works fine (except atexit() ). Where did
you get libpng10 and libpng12 from?>The gcc I have is: 2.95.3-6 (mingw special)

Any more tips? Do you guys having png-files working with SDL_image?
/Patrich

Stanley Brown <@Stanley_Brown> wrote …

Stanley,
Try build the library Im your local environment but use this DLLS:
http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.3-win32.zip.

???

Are you responding to my suggestion for Patrich Bj?rklund to check for
libpng1.dll in his path?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi Stanley. I got the 12 from the libpng.org site (or rather their place
on sourceforge.net). That is a funny thing, you mention the '-lmwindows’
because my setup is complaining on that missing. I have tried that, but
never been able to trace that compile option down, and make that a valid
link option. And what you say do make sense, coz I have never been
needed to compile with -lz and -lpng.

That syntax did I get from a textfile (SDL_image.la). But all in all, as
I see it, everything should work if I get the…wait a minute.
’-mwindows’?? Gaah! Is it that simple? A misspelling. NOT '-lmwindows’
right? Have to try that next time!

Really appreciate the info and your help!

/Patrich> uld have read your email more closely earlier:

gcc png.c -o png -lmingw32 -lz -lpng -lSDL -lSDLmain -lSDL_image

You shouldnt have to link the png libs since SDL_image is already compiled against it. This should work:

gcc -mwindows -o png png.c -lmingw32 -lSDLmain -lSDL -lSDL_image

I compiled your code and it works fine (except atexit() ). Where did
you get libpng10 and libpng12 from?

By the way, you need to build any code linked with SDL on Windows with
the MSVC runtime, and not the Cygwin runtime - SDL is a native library.
You can do this with cygwin by passing -mwindows when compiling and linking.

I’m in the process of putting together SDL_image and SDL_mixer development
archives for mingw32, which you can also use in the Cygwin environment.
Check the library pages in a few days and bug me if they’re not done. :slight_smile:

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Thanks for the input, Sam. The results will not show though. :frowning: I have made this work once under cygwin, but never documented how. What I have is:----------------------------------------------------------------

*Dev-Cpp & it’s SDL+SDL_image packages
*SDL.DLLs and PNG.DLLs in bot development environment and system env.
*A working c-codesnippet for loading my png file (whom do exist too) :slight_smile:
*executeing gcc like this:

gcc.exe SDLpng.c -o SDLpng.exe -mwindows -lmingw32 -lSDLmain -lSDL -lSDL_ttf -lSDL_image -lobjc -g3 -I"C:\Program\Dev-Cpp\include" -I"C:\Program\Dev-Cpp\lib\gcc-lib\mingw32\2.95.3-6\include" -L"C:\Program\Dev-Cpp\lib" -L"C:\Program\Dev-Cpp\mingw32\lib" -L"C:\Program\Dev-Cpp\Dll"

*Result:Fatal signal: Segmentation Fault (SDL Parachute Deployed)

Now, what can possibly be wrong? I go crazy any minute here now. I can smell a dll-hell scenario. I think I have to deinstall and remove dlls and try it all over again after you’ve put those dev-packages in the library pages. =)

/Patrich

Sam Lantinga wrote …

By the way, you need to build any code linked with SDL on Windows with
the MSVC runtime, and not the Cygwin runtime - SDL is a native library.
You can do this with cygwin by passing -mwindows when compiling and linking.

I’m in the process of putting together SDL_image and SDL_mixer development
archives for mingw32, which you can also use in the Cygwin environment.
Check the library pages in a few days and bug me if they’re not done. :slight_smile:

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I re-read your mail…MSVC? So, I shalt not do the -mwindows with Dev-Cpp/mingw32?
/Patrich>Sam Lantinga wrote …

By the way, you need to build any code linked with SDL on Windows with
the MSVC runtime, and not the Cygwin runtime - SDL is a native library.
You can do this with cygwin by passing -mwindows when compiling and linking.

I’m in the process of putting together SDL_image and SDL_mixer development
archives for mingw32, which you can also use in the Cygwin environment.
Check the library pages in a few days and bug me if they’re not done. :slight_smile:

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I re-read your mail…MSVC? So, I shalt not do the -mwindows with Dev-Cpp/mingw32?

No, you shalt. The -mwindows flag tells mingw and cygwin to use msvc runtime.
Don’t worry, the development packages should fix your problems.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Sam-

I haven’t used Cygwin’s compiler in some time but dont they have to
include “-mno-cygwin” to link against msvc runtime. Or does "-mwindows"
force this?

Sam Lantinga wrote:>>I re-read your mail…MSVC? So, I shalt not do the -mwindows with Dev-Cpp/mingw32?

No, you shalt. The -mwindows flag tells mingw and cygwin to use msvc runtime.
Don’t worry, the development packages should fix your problems.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Stanley: I have used cygwin for linking SDL and SDL_image, and I never
used your method, but -mwindows I do reccon…

I never got SDL_ttf working with it back then, so I abandoned it for
programming…

/Patrich
fre 2003-03-14 klockan 20.50 skrev Stanley Brown:> Sam-

I haven’t used Cygwin’s compiler in some time but dont they have to
include “-mno-cygwin” to link against msvc runtime. Or does "-mwindows"
force this?

Sam Lantinga wrote:

I re-read your mail…MSVC? So, I shalt not do the -mwindows with Dev-Cpp/mingw32?

No, you shalt. The -mwindows flag tells mingw and cygwin to use msvc runtime.
Don’t worry, the development packages should fix your problems.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Patrich Bj?rklund <@Patrich_Bjorklund>
Home Factory

Hi! I’ve solved my problems with SDL_image (PNG) loadings in Dev-C++.
Just clearing this out so this list wont get “spammed” more than usual.

I just picked up the latest SDL-1.2.3 dll’s and cleaned out some I found
under my ‘lib’ directory (in my desperate attempts I shoved some more
dlls than necessary). That made a successful exe-file for me. :o)

Thanks everybody for helping me out!–
Patrich Bj?rklund <@Patrich_Bjorklund>
Home Factory