How to link libxml when compiling?

Discussion in 'C Programming' started by geoplab, May 28, 2007.

  1. geoplab

    geoplab Guest

    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
    geoplab, May 28, 2007
    #1
    1. Advertising

  2. In article <>,
    geoplab <> wrote:
    >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.
    --
    I was very young in those days, but I was also rather dim.
    -- Christopher Priest
    Walter Roberson, May 28, 2007
    #2
    1. Advertising

  3. geoplab wrote:
    > 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.
    Martin Ambuhl, May 28, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    810
    Kevin Spencer
    May 17, 2005
  2. Ian Gregory
    Replies:
    1
    Views:
    503
  3. Olav
    Replies:
    3
    Views:
    4,232
  4. Garrett Cooper
    Replies:
    0
    Views:
    552
    Garrett Cooper
    Feb 24, 2009
  5. Garrett Cooper
    Replies:
    0
    Views:
    492
    Garrett Cooper
    Feb 24, 2009
Loading...

Share This Page