This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Order of .o-files and .a-files
- To: gcc at gcc dot gnu dot org
- Subject: Order of .o-files and .a-files
- From: Henrik Nilsson <Henrik dot Nilsson at west dot se>
- Date: Fri, 17 Nov 2000 11:54:40 CET
- Reply-To: Henrik dot Nilsson at west dot se
I'm currently developing in FreeBSD using version 2.95.2 of gcc.
I'm having trouble understanding why the order of certain files is important.
If you look a t the examples below (1-3). The same files are being linked in
1) and 2),
yet example 2) does not work. Why is this?
As you can see from example 3) I have got it to work, but still it remains a
puzzle.
Thanks,
Henrik Nilsson
ps. please reply to my email as well, as I'm not a member of this
mailinglist. ds.
1)
# This works!
gcc XmlParser.o XmlException.o main.cpp -o main
2)
# This doesn't work! (Undefined reference of XmlParser.o & XmlException.o)
# libxmlparser.a consist of XmlParser.o & XmlException.o
gcc libxmlparser.a main.cpp -o main
3)
# This works!
# libxmlparser.a consist of XmlParser.o & XmlException.o
gcc main.cpp libxmlparser.a -o main