The order of arguments differs
spam.spam.spam.spam@free.fr
spam.spam.spam.spam@free.fr
Wed Feb 15 14:42:00 GMT 2012
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.
More information about the Gcc-help
mailing list