error LNK2019: unresolved external symbol

Nov 5, 2009 at 11:19pm
I was trying to compile my C code when a fatal error came up.

the error is: >lab 10.obj : error LNK2019: unresolved external symbol "void __cdecl best(struct type_player * const,int)" (?best@@YAXQAUtype_player@@H@Z) referenced in function _main

my code is:

#include <stdio.h>
#include <string.h>

struct type_player
{
char name1[20], name2[20];
int scoring_ability1, scoring_ability2, valid;
};

// function prototypes that you have to develop
void read(struct type_player player[], int *N);
void check(struct type_player player[], int N);
void best(struct type_player player[], int N);

int main()
{
struct type_player player[100];
int N;


read(player, &N);

check(player, N);

best(player, N);

return 0;
}
void read( struct type_player type[], int *n)
{
int i=0;

FILE *fin = fopen("data.txt", "r");

if(fin == NULL)
printf("File could not be opened.\n");
else
{
fscanf(fin, "%d", &n);

while(!feof(fin))
{
fscanf(fin, "%s %s %d %d %d", &type[i].name1, &type[i].name2,
&type[i].scoring_ability1,&type[i].scoring_ability2, &type[i].valid);

type[i].valid= 1;

i++;
}
}

fclose(fin);

}

i tried to google the definition of the error and how to solve it but there were no suitable answers.

Nov 5, 2009 at 11:25pm
You didn't define neither check() nor best(). You only declared them.
Topic archived. No new replies allowed.