Mail Archives: djgpp/2000/01/11/20:15:07
Goodday BRAD,
The mistakes were quite small ones but enough to cause quite a
lot of misleading errors from the compiler.
There were no problems with the header files. just the "C" source
code. Please see below for the changes you have to make.
A summary of the 2 errors I found were.
1. file 051sc.c - there is a missing "{" after the circle_init function.
Please add it.
2. file 051s.c- please remove the line "END_OF_MAIN()" after the
main function.
I've posted the changes below as well.
//////////////////051sc.c/////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <allegro.h>
#include "051sc.h"
CIRCLE_T *circle_init(int new_x, int new_y, int new_radius,
int new_col, int new_xs, int new_ys)
{ //<----- This brace should be here like this. Otherwise you get the
parse errors.
CIRCLE_T *temp;
// Allocate memory for the circle. If unsuccessful, return NULL.
temp = malloc(sizeof(CIRCLE_T));
if (!temp)
return NULL;
temp->x = new_x;
temp->y = new_y;
temp->r = new_radius;
temp->col = new_col;
temp->xs = new_xs;
temp->ys = new_ys;
temp->dx = temp->dy = 0;
return temp;
}
No other problems found in file 051sc.c So the rest of the code is
not shown.
///////////////////051s.c/////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <allegro.h>
#include "051s.h"
#include "051sc.h"
int end_game; /* flag we'll set to end the game */
BITMAP *dblbuffer;
CIRCLE_T *moving_circle;
int main(void)
{
allegro_init(); /* initialise the Allegro library */
init(); /* initialise the game */
end_game = 0; /* reset flag */
do { /* loop */
input(); /* get input */
process(); /* process it */
output(); /* give output */
} while (end_game == 0); /* until the flag is set */
shutdown(); /* shut down anything that needs it */
allegro_exit(); /* just for luck */
return 0; /* tell the OS that all went well */
}
//END_OF_MAIN() <---please remove this statement or comment
it out as I have already done with two "//". It is the one causing you
the other problems.
Now it compiled and ran without problems (looks good). It wasn't a
problem with RHIDE it is a problem with the source code of the
vivace tutorial.
If you want to compile it in RHIDE. just add the "C" files to the
project and it should work as normal.
BTW If there is anything I've overlooked please post again.
Take Care,
Kalum
- Raw text -