Mail Archives: djgpp/2000/03/06/14:40:57
Hi !
Here is an example of source with the project file for rhide. This example
work only if you don't setup variables with values (like a=2;).
In this example, this is not really a problem, but my program needs to
assign values to var in header files.
source of header f.h :
#include <stdlib.h>
#include <stdio.h>
#include "allegro.h"
#ifndef FONC_H
#define FONC_H
// here
int d_a=10;
int d_b=11;
extern int calcab(int a, int b);
#endif
----------------
source of f.c :
#include "fonc.h"
int calcab(int a, int b)
{
return a*b+d_a;
}
--------------
source of main.c :
include <stdlib.h>
#include <stdio.h>
#include "allegro.h"
#include "fonc.h"
int calcabi(int a, int b)
{
return (d_a*a)+(d_b*b);
}
int main()
{
int r;
allegro_init();
install_keyboard();
printf("\nBonjour !");
r=calcab(d_a,d_b)+calcabi(7,8);
printf("%d*%d=%d",d_a,d_b,r);
readkey();
set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
set_pallete(desktop_pallete);
textout_centre(screen, font, "Hello, world!", SCREEN_W/2, SCREEN_H/2, 255);
readkey();
return 0;
}
--------end---------
- Raw text -