File format not recognized

closed account (NUj6URfi)
This is my code with issues:

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>
#include <SDL.h>
#include <SDL_image.h>

int main(int argc, char **argv)
{
		  int exited=0;
		  SDL_Surface *screen, *image;
		  SDL_Rect rect;
		  if(SDL_Init(SDL_INIT_VIDEO)<0){
					 fprintf(stderr,"Problem loading movie.",
SDL_GetError());
					 exit(1);
		  }
		  atexit(SDL_Quit);
		  screen=SDL_SetVideoMode(640,480,16,SDL_SWSURFACE);
		  if(screen==NULL){
					 fprintf(stderr,"Couldn't set video mode: %s\n",
SDL_GetError());
					 exit(1);
		  }
		  image=IMG_Load("Frame1.jpg");
		  if(image==NULL){
					 fprintf(stderr,"Couldn't load movie\n");
					 exit(1);
		  }
		
if(SDL_SetColorKey(image,SDL_RLEACCEL,SDL_MapRGB(image->format,0,0,0))){
					 fprintf(stderr,"Couldn't ser color key: %s\n",SDL_GetError());
					 exit(1);
		  }
		  image=SDL_DisplayFormat(image);
		  rect.x=100;rect.y=100;rect.w=image->w;rect.h=image->h;
		  SDL_BlitSurface(image,0,screen,&rect);
		  SDL_UpdateRects(screen,1,&rect);
		  while(exited==0){
					SDL_Event event;
					if(SDL_PollEvent(&event)==1){
							  if((event.type==SDL_KEYDOWN &&
event.key.keysym.sym==SDLK_ESCAPE) ||
(event.type==SDL_QUIT))exited=1;
					}
		  }
		  return 0;
}


The problem is I get a file format not recognized error. I linked to all the files that were required (the .dll, and .h). I typed the linker command for SDL in and the samething for image but I replaced SDLmain with SDLimage . I don't have any details on the error like what file or format. Please help.
You have not given enough information in this thread to be helped, but I do know some extra information because you have posted already in another thread you have running for the same topic...

Please look at the tutorial link I posted in your other thread. You are going to always need to link to
-lmingw32 -lSDLmain -lSDL
in addition to anything extra you want to link to.
Just in case you need that tutorial link again: http://lazyfoo.net/SDL_tutorials/lesson01/windows/devcpp/index.php
It really should be simple to look at this page and find exactly what you need to setup a Dev-C++ project to be able to work with SDL. Lazy foo even has screenshots in the tutorial to show what to click when setting up the project...

The SDL include lines should have SDL/ and should be in quotes ("") instead of angle brackets (<>), if you have Dev-C++ setup the same way as other people who have used SDL in Dev-C++
Last edited on
Topic archived. No new replies allowed.