Allegro error

I'm making a bouncy ball program, but get this error:
[Linker error] undefined reference to `WinMain@16'
ld returned 1 exit status
C:\Dev-Cpp\Makefile.win [Build Error] [ballen.exe] Error 1

I've included liballeg.a in the linker.

The code is:
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
46
47
48
49
50
51
52
53
#include <allegro.h>
#include <cstdlib>
#include <iostream>

int x = 100;
int y = 100;

int tempx = 100;
int tempy = 100;

int dir = 1;

void moveball();   
      
int main(int argc, char *argv[])
{
    allegro_init();
    install_keyboard();
    set_color_depth(16);
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
    
    while ( !key[KEY_ESC])
    {moveball();}
    return EXIT_SUCCESS;
}

void moveball()
{
     tempx = x;
     tempy = y;
     
if(dir ==1 && x !=20 && y !=20)
   {--x;
   --y;}
     else if (dir == 2 && x !=20 && y !=460)
     {--x;
      ++y;}
      else if (dir == 3 && x !=620 && y !=20)
      {++x;
      --y;}
      else if (dir == 4 && x !=620 && y !=460)
      {++x;
      ++y;}
      else 
      {dir = rand() % 4 + 1;}

acquire_screen();
circlefill (screen, tempx, tempy, 20, makecol(0,0,0));
circlefill (screen, x, y, 20, makecol(225, 50, 225));
release_screen();

rest(10);
}


What to do?
Switch to code::blocks >.< DevCpp is no longer updated, so it is outdated.(re-post if the error persists)
@Hethrir

He could easily be using wxDev-cpp. It's default install folder is the same as the archaic Dev-cpp that it is spawned from.

Anyways. Dustegeek, try putting the macro function END_OF_MAIN(); after your main.
Thanks, xander337, it worked :D
Topic archived. No new replies allowed.