I am trying to make a program import a function to another however after following the steps I saw in a tutorial I can't make it work here's the main program:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "projet.h"
In this program I call a function named Mise
who is defined in another program:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "projet.h"
int Mise(int ChoixChiffre[37], int ChoixCouleur, int ChoixDouzaine[3], int ChoixParite, int ChoixPlage, int MiseChiffre[37], int MiseCouleur, int MiseDouzaine[3], int MiseParite, int MisePlage, int ArgentJoueur) //Main function
And in the .h file I wrote this:
#ifndef PROJET_H
#define PROJET_H
int Mise(int ChoixChiffre[37], int ChoixCouleur, int ChoixDouzaine[3],
int ChoixParite, int ChoixPlage, int MiseChiffre[37],
int MiseCouleur, int MiseDouzaine[3], int MiseParite,
int MisePlage, int ArgentJoueur);
#endif
When I compile the program I have an error with undefined reference when I call Mise()
in a function
I tried removing the call to Mise()
and the program works perfectly fine, changed the .h program a little and it changed nothing.
the Makefile looks like this:
tpimage: tpimage.o libisentlib.a
gcc -Wall tpimage.o -o tpimage libisentlib.a -lm -lglut -lGL -lX11
./tpimage
The error is the following:
gcc -Wall tpimage.o -o tpimage libisentlib.a -lm -lglut -lGL -lX11
/usr/bin/ld : tpimage.o : dans la fonction « gestionEvenement » :
tpimage.c:(.text+0x1d8b) : référence indéfinie vers « Mise »
collect2: error: ld returned 1 exit status
make: *** [makefile:2 : tpimage] Erreur 1