Hi guys, this is my first post! My name is Albert and I'm from Spain! Nice to meet you!
This is my first year programming in C and I've got a problem with my code.
I'm using VIM editor to code and I don't know how to copy/paste the code, so I have to type it again.
While I'm compiling, the following error appears:
main.c: (text+0x1e2): undefined reference to 'carregaEnemics'
main.c: (text+0x1fb): undefined reference to 'carregaClasses'
MAIN.C:
Code:
#include "total.h"
void main(int argc, char* argv[]){
FILE *f,*g,*h;
int nCorrecte = 0, nOpcio, nEnemics, nClas;
Classe *classes;
Enemic *enemic;
Personatge personatge;
srand(time(NULL));
f = fopen(argv[2],"r");
if(f == NULL){
printf("Error!\");
}
else{
g = fopen(argv[3],"r");
if(g == NULL){
printf("Error!\n");
}
else{
carregaEnemics(g,enemic,&nEnemics);
carregaClasses(f,classes,&nClas);
//There is more code but I think it's not important.
...
}
TOTAL.H
Code:
#ifndef TOTAL_H
#define TOTAL_H
#include "tipus.h"
#include "cua.h"
//That .h files include only structs.
void carregaEnemics(FILE *f, Enemic *enemic, int *nEnemics);
void carregaClasses(FILE *h, Classe *classes, int *nClas);
//There are more functions but I think that they are not important to solve this problem.
...
#endif
That's all guys! Thank you for your help and sorry if I've done some mistakes while writing in english