SDL error with - cstdlib library

So i'm working on a snake game for my final projected for school and having a little trouble i'm used net-beans all year and bc im doing a SDL net-bean does not run SDL so i'm doing it on code::blocks?

so i'm trying to set up a class so my snake can move,
so my code worked fine until i added the class.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <cstdlib> // says there is no such file or detractor 
#include "SDL/SDL.h"


class snakeMove {
private:
    int x,y;
    int xVal,yVal;

public:

    square();

    void handle_input();
   //moves the square
    void move();

    //Shows the square on the screen
    void show();
    };


Are you sure the error is happening on that line? Is this in a file that is being included by other files?
yes it is on that line and the only files i have added was the SDL files that i got off http://lazyfoo.net/SDL_tutorials/lesson16/index.php @LB

all my code
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
#include <cstdlib>
#include "SDL/SDL.h"


class snakeMove {
private:
    int x,y;
    int xVal,yVal;

public:

    square();

    void handle_input();
   //moves the square
    void move();

    //Shows the square on the screen
    void show();
    };


int main( int argc, char* args[] )
{
    //The images
    SDL_Surface* snake = NULL;
    SDL_Surface* screen = NULL;



   SDL_Init( SDL_INIT_EVERYTHING );

       screen = SDL_SetVideoMode( 800, 800, 32, SDL_SWSURFACE );
       snake = SDL_LoadBMP("snake.BMP");

    SDL_BlitSurface( snake, NULL, screen, NULL );
       SDL_Flip(screen);
       SDL_Delay(2000);
       SDL_FreeSurface(snake);
       SDL_QUIT;


    return 0;
}
Last edited on
Can you compile the hello-world program? If not, you may have COde::Blocks misconfigured so that the compiler can't find the standard library include files - try reinstalling.
so i tried the hello world program and it did not compile so i uninstalled code-blacks and am waiting for it to re-install, ill let you know if it works

--thank you
it worked thanks for the help @LB
Topic archived. No new replies allowed.