gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > library linking

#25429 - Mephisto - Sun Aug 22, 2004 8:19 pm

this is my compilation lines :
Code:
gcc -c main.c
gcc -o test.elf lib.a main.o


and it says :
undefined reference to 'Fonction'

'Fonction' is included in lib.a
and 'Fonction' is the correct name.
Even with prototypes before 'Fonction' calling, it says that.

what's wrong ?

edit: sorry i forgot test.elf ... problem still on


Last edited by Mephisto on Sun Aug 22, 2004 9:16 pm; edited 1 time in total

#25431 - CATS - Sun Aug 22, 2004 8:35 pm

edit: sorry, didn't read the whole post

#25432 - sajiimori - Sun Aug 22, 2004 8:50 pm

The argument after -o is the output filename, which means it's trying to write lib.a, not link it in.

#25433 - Mephisto - Sun Aug 22, 2004 9:17 pm

sorry i forgot to write the output filename test.elf

#25441 - sajiimori - Mon Aug 23, 2004 2:31 am

Ok, then put the .a file after the .o.

#25444 - Mephisto - Mon Aug 23, 2004 4:37 am

thx you