How to link libxml when compiling?

G

geoplab

I have this error message when compiling mx_init.c by linking libxml
library as follow:

gcc `xml2-config --cflags` -c mx_init.c `xml2-config --libs` -g -Wall
gcc: -lxml2: linker input file unused because linking not done
gcc: -lz: linker input file unused because linking not done
gcc: -lpthread: linker input file unused because linking not done
gcc: -lm: linker input file unused because linking not done

How can I fix this error?
Thank you in advance.

Jimin Lee
 
W

Walter Roberson

I have this error message when compiling mx_init.c by linking libxml
library as follow:
gcc `xml2-config --cflags` -c mx_init.c `xml2-config --libs` -g -Wall
gcc: -lxml2: linker input file unused because linking not done
gcc: -lz: linker input file unused because linking not done
gcc: -lpthread: linker input file unused because linking not done
gcc: -lm: linker input file unused because linking not done
How can I fix this error?

gcc and libraries are not really on topic in comp.lang.c, which
deals with the C language rather than with the specifics of
any implementation.

<OT>
Read the output. The libraries were not used because linking
was not done. Why was linking not done? Because you told it not
to link.

$ man gcc
-c Compile or assemble the source files, but do not link. The link-
ing stage simply is not done.
 
M

Martin Ambuhl

geoplab said:
I have this error message when compiling mx_init.c by linking libxml
library as follow:

gcc `xml2-config --cflags` -c mx_init.c `xml2-config --libs` -g -Wall
gcc: -lxml2: linker input file unused because linking not done
gcc: -lz: linker input file unused because linking not done
gcc: -lpthread: linker input file unused because linking not done
gcc: -lm: linker input file unused because linking not done

How can I fix this error?

This is compiler-specific, so really doesn't belong in comp.lang.c. A
gcc newsgroup or mailing list might have been a better choice. An even
better choice is to check your documentation, where you would find that
the "-c" flag tells the compiler not to link or produce an executable.
Since it refuses to do what you told it not to do, there is no error.
Here's a hint: when an application does what you tell it to, and you
don't like the result, then you probably told it the wrong thing to do.
Thank you in advance.

Bite me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top