delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/11/20:15:07

Message-Id: <200001121203.GAA07004@lakdiva.slt.lk>
From: "Kalum Somaratna aka Grendel" <kalum AT newmail DOT net>
To: djgpp AT delorie DOT com
Date: Wed, 12 Jan 2000 06:03:39 +0600
MIME-Version: 1.0
Subject: Re: PREVIOUS ? CODE!!
CC: bjmurphy AT sympatico DOT ca
In-reply-to: <387A90E0.85327532@sympatico.ca>
X-mailer: Pegasus Mail for Win32 (v3.12)
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019