unresolved external symbol
Feb 23, 2011 at 6:34am UTC
Everytime I call a function to populate a struct array I get this error:
1 2
main.obj : error LNK2001: unresolved external symbol "void __cdecl Populate(struct Enemy)" (?Populate@@YAXUEnemy@@@Z)
C:\Users\Tyler\Documents\Visual Studio 2010\Projects\Bizzles_Labyrinth\Release\Bizzles_Labyrinth.exe : fatal error LNK1120: 1 unresolved externals
I've tried making a small program to do the same thing and it works without issue but for some reason I cannot get it to work else where.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
void Populate(Enemy* p_enemy) {
int flag;
for (int i=0; i<199; i++){
flag = rand()%1;
switch (flag){
case 1:{ //Flycan
p_enemy[i].name = 1;
p_enemy[i].hp = 5;
p_enemy[i].ap = 1;
p_enemy[i].graphic = 1;
p_enemy[i].x = rand()%10000;
p_enemy[i].y = rand()%10000;
}
}
}
}
this is populate.cpp. it's supposed to take Enemy *enemy = new Enemy[199]; and fill it but all I ever get is an error. Any idea why it wont take it?
Feb 23, 2011 at 6:40am UTC
To begin with, the error mentions Enemy - not Enemy* - so
there is something wrong between your function prototype, or function definition or something like that.
So what should it be - Enemy or Enemy*
Feb 23, 2011 at 7:00am UTC
Wow I've been fighting with this for a week and all it was was mismatched asterisk. Thank you for your help.
Topic archived. No new replies allowed.