delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/12/15:11:02

Sender: nate AT cartsys DOT com
Message-ID: <3672CC07.9D123C9D@cartsys.com>
Date: Sat, 12 Dec 1998 12:03:19 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: need help with data files.
References: <3672A85D DOT E72503A0 AT hotmail DOT com>
Reply-To: djgpp AT delorie DOT com

beer god wrote:
> 
> when i try to complie this:
> #include<allegro.h>
> #include"pics.h"
> 
> main()
> {
>  DATAFILE *data;
>  BITMAP *titlescreen, *title;
>  BITMAP *big_g, *buffer;
> 
>  allegro_init();
>  install_keyboard();
>  set_color_depth(15);
>  set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
> 
>  data = load_datafile("pics.dat");
>  set_pallete((RGB*)data[pallete].dat);
>  titlescreen = (BITMAP *)data[titlescreen].dat;
>  title = (BITMAP *)data[title].dat;
>  big_g = (BITMAP *)data[thebig_g].dat;
>  buffer = create_bitmap(640, 480);
> 
>  blit(titlescreen, buffer, 0, 0, 0, 0, 640, 480);
>  masked_blit(title, buffer, 0, 0, 46, 68, title->w, title->h);
>  masked_blit(big_g, buffer, 0, 0, 33, 235, big_g->w, big_g->h);
>  blit(buffer, screen, 0, 0, 0, 0, 460, 480);
> 
>  readkey();
>  allegro_exit();
>  return 0;
> }
> i get:
> C:\CyberLake\Games\ggotchi>gxx test2.cpp -o data.exe -lallegro
> test2.cpp: In function `int main()':
> test2.cpp:7: parse error before `8'
> test2.cpp:17: non-lvalue in assignment
> test2.cpp:18: non-lvalue in assignment
> test2.cpp:22: warning: passing `int' to argument 1 of `blit(BITMAP *,
> BITMAP *,
> int, int, int, int, int, int)' lacks a cast
> test2.cpp:23: base operand of `->' is not a pointer
> test2.cpp:23: base operand of `->' is not a pointer
> test2.cpp:23: warning: passing `int' to argument 1 of
> `masked_blit(BITMAP *, BIT
> MAP *, int, int, int, int, int, int)' lacks a cast
> 
> any help would be greatful.

I suspect your problem lies in "pics.h", which you didn't post.  It
looks like `title' or `titlescreen' or both are being #defined to
something unexpected (perhaps a number).  This might be because of what
you've named the datafile objects.  Either those or the variable names
will have to change.
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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