Mail Archives: djgpp/2000/03/06/22:45:15
Hello,
I believe I have a solution for you that will solve your problems:
change the two lines that say:
int d_a=10;
int d_b=11;
TO:
#define d_a 10
#define d_b 11
That should take care of your problems. Hope this helps, and good luck.
-David C.
Cyberdivad wrote:
>
> 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 -