This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
The order of arguments differs
- From: spam dot spam dot spam dot spam at free dot fr
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 15 Feb 2012 15:41:46 +0100 (CET)
- Subject: The order of arguments differs
Hello,
I am compiling a program on 2 computers.
Table of contents
1. First computer
2. Second computer
3. Conclusion
1. First computer
$ gcc src/main.c `xml2-config --libs` `xml2-config --cflags`
Now with a different order of arguments :
$ gcc `xml2-config --libs` `xml2-config --cflags` src/main.c
/tmp/ccXlXfPu.o: In function `parseDoc':
main.c:(.text+0xd): undefined reference to `xmlParseFile'
main.c:(.text+0x51): undefined reference to `xmlCleanupParser'
main.c:(.text+0x63): undefined reference to `xmlFreeDoc'
main.c:(.text+0x68): undefined reference to `xmlCleanupParser'
collect2: ld a retournà 1 code d'Ãtat d'exÃcution
So, I must put the input file first.
Problem : this is not what is written on my man :
$ man gcc
SYNOPSIS
gcc [-c|-S|-E] [-std=standard]
[-g] [-pg] [-Olevel]
[-Wwarn...] [-pedantic]
[-Idir...] [-Ldir...]
[-Dmacro[=defn]...] [-Umacro]
[-foption...] [-mmachine-option...]
[-o outfile] [@file] infile...
$ gcc --version
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright  2011 Free Software Foundation, Inc.
...
2. Second computer
$ gcc src/main.c `xml2-config --libs` `xml2-config --cflags`
$ gcc `xml2-config --libs` `xml2-config --cflags` src/main.c
So it works with any order.
$ gcc --version
gcc (Debian 4.4.5-8) 4.4.5
Copyright  2010 Free Software Foundation, Inc.
...
3. Conclusion
It's a big problem to have a different behaviour on each computer.
My autotools put the input file at the end, so the compile failed on the first computer.
Do you think it's a gcc problem?
Thank you.