test.exe stopped working

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifdef __cplusplus
    #include <cstdlib>
#else
    #include <stdlib.h>
#endif

#include <SDL/SDL.h>
#include <string>
#include <SDL/SDL_image.h>

SDL_Surface* LoadImage(std::string Path){
    SDL_Surface* LoadedImage = NULL;
    SDL_Surface* OptimizedImage = NULL;
    LoadedImage = IMG_Load(Path.c_str());
    if(LoadedImage != NULL) {
        OptimizedImage = SDL_DisplayFormat( LoadedImage );
        SDL_FreeSurface( LoadedImage );
    }
    return OptimizedImage;
}

int main ( int argc, char** argv )
{
    SDL_Surface* bg = NULL;
    bg = LoadImage("bg2.png");
    if(bg == NULL)return 1;

    return 0;
}


me again. :D sorry but since i m a newbie having hard times solving problems.

whatever this is the program and the output is
Checking for existence: C:\Users\Ceset\Desktop\test\bin\Debug\test.exe
Executing: "C:\Users\Ceset\Desktop\test\bin\Debug\test.exe"  (in C:\Users\Ceset\Desktop\test\.)
Process terminated with status -1073741819 (0 minutes, 1 seconds)


i have all sdl_image dlls in debug folder and i have bg2.png at C:\Users\Ceset\Desktop\test location. but i get the error test.exe stopped working(OS win 7).
Ok, Try putting sdl_images.dll in the test folder as well, instead of the debug. By default, the program will search in the test folder (if you run from the compiler).
EDIT: I didn't think SDL could handle .png with LoadImage without a wrapper, was I wrong?
Last edited on
nope nothing happens i copied as you told(i think something about OS might be or .png lib not sure)

well it should have a wrapper but not needed since it is a test project. its only purpose is to test. and as far as i know it will load even without a cleaner.

sorry if i misunderstand

EDIT: i tried the func with sdl_loadbmp func and it worked fine maybe .dll file is problematic or my func. but if my func is problematic shouldnt it give compiling errors ??

EDIT2:well i redownload the .dll files and at least it gave me a better error explanation now
the error is The Application was unable to start correctly (0xc000007b)

EDIT3:well i get the idea .dlls might be the porblem and went to this page
http://www.libsdl.org/projects/SDL_image/release-1.2.html
donwloaded and tried all binaries and .dlls r not the problem
and i replaced many of my sdl_image lib files and tried again prob is not them

i m totally lost. dont have any idea about what might be the problem
Last edited on
wow. i went to eat some stuffs and shutted down the computer. i returned and started the computer. and finally it gave me an error. so no prob anymore
i found out what coused this mess. if your compiler ever have a prob with undefined reference to IMG_Load func. some people advices to use (this is for sdl_image 1.2.12) 32 bit .dll files even if u use 64 bit OS. well never do that. after changing .dll files to 32 and compiling the prog. it gives u this error and even if u change the .dll files to 64 bit again. u cant fix the prob. to fix the prob u had to rebuild your project(not sure but a restart might be needed). by the way i use code::blocks
Last edited on
PROTIP: Trying things at random without understanding what they do or why they should (or shouldn't) work is in fact not the way to solve problems.

Whether you link to 32- or 64-bit DLLs depends on which toolkit you use to build your main project, not on the architecture your OS is designed for.
yes i agree but if we talk about a newbie(just like me) they just do what they r told more than knowing what they do
Topic archived. No new replies allowed.