Bonjours, j'ai un probleme dans mon programme, dev me marque
[Linker error] undefined reference to `creer_missile'
Le but du programme est de creer un deplacement de missile tout en rendant possible le deplacement de la personne(normalement avec le gotoxy) et je voudrai aussi pouvoir tirer d'autre missiles pendant que l'autre est en train de se deplacer,
Si quelqu'un a une idée,merci
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 void tirer(int *u) { int i,j; char tab[10][30]; while(*u!=20) { sleep(20); *u++; for(i=0;i<20;i++) { for(j=0;j<20;j++) {printf("%c",tab[i][j]); } } } }
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "mabib.h" int main(int argc, char *argv[]) { int i,c,l; char key,tab[10][30]; t_miss m; m.x=1; m.y=10; gotoxy(m.x,m.y); printf("X"); key=getch(); while(key!='q') {m.x=c; m.y=l; if(key=='5') creer_missile(c,l); } }
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #ifndef MABIB_H #define MABIB_H #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <time.h> #include <string.h> #include <time.h> void gotoxy(int,int); typedef struct miss{ int x; int y; char c; } t_miss; #endif
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 void gotoxy(int x,int y) { COORD mycoord; mycoord.X =x; mycoord.Y =y; SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), mycoord ); } void creer_miss(int c, int l) { char tab[10][30]; int i,j,u; t_miss m; m.x=c+1; m.y=l; m.c='-'; //positionnement du missile for(i=0;i<20;i++) { for(j=0;j<20;j++) { if((i=(m.x))&&(j=(m.y))) { tab[i][j]=(m.c); printf("%c",(m.c)); } else tab[i][j]=' '; } } u=(m.x); tirer(&u); }