The order of arguments differs

Kai Ruottu kai.ruottu@wippies.com
Mon Feb 20 10:45:00 GMT 2012


20.2.2012 10:31, spam.spam.spam.spam@free.fr kirjoitti:

> First computer :
> gcc -Wall -Wextra `xml2-config --cflags` -g -O2 `xml2-config --libs`  -o xmlparsefile xmlparsefile-main.o
> make[1]: Leaving directory `/.../1-xmlParseFile/src'
> make[1]: Entering directory `/.../1-xmlParseFile'
> make[1]: Nothing to be done for `all-am'.
> make[1]: Leaving directory `/.../1-xmlParseFile
>
> Second computer :
> gcc -Wall -Wextra `xml2-config --cflags` -g -O2 `xml2-config --libs`  -o xmlparsefile xmlparsefile-main.o
> xmlparsefile-main.o: In function `parseDoc':
> main.c:(.text+0xd): undefined reference to `xmlParseFile'
> main.c:(.text+0x51): undefined reference to `xmlParseFile'
> main.c:(.text+0x63): undefined reference to `xmlParseFile'
> main.c:(.text+0x68): undefined reference to `xmlParseFile'
> collect2: ld returned 1 exist status
>
> Do you understand why I got this error on one computer, and not on the other?

Too complicated... You should simply look what the command :

gcc -Wall -Wextra `xml2-config --cflags` -g -O2 `xml2-config --libs` \
-o xmlparsefile xmlparsefile-main.o

causes during the link phase. The '-v' option for GCC and '-verbose'
for the linker ('-Wl,-verbose' for GCC) are good tools for this. Just
add them somehow to the process or try the command manually with the
additions :

gcc -v -Wall -Wextra `xml2-config --cflags` -g -O2 \
`xml2-config --libs` -o xmlparsefile xmlparsefile-main.o

gcc -Wl,-verbose -Wall -Wextra `xml2-config --cflags` -g -O2 \
`xml2-config --libs` -o xmlparsefile xmlparsefile-main.o



More information about the Gcc-help mailing list