1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

use .a object in cygwin

Discussion in 'C' started by davidhai, Oct 29, 2008.

  1. davidhai

    davidhai New Member

    Joined:
    Sep 29, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hi everybody,

    Anybody used to build a program by cygwin and integrate .a object to use in the program,please help me to solve my problem.

    I make a sample c++ that is built by cygwin. My sample uses library .a object. I want to add .a object to cygwin library to build my sample. If anybody knows about this, please guide me to integrate it into cygwin to build my sample.

    Many thanks.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Could you clarify what you mean by "integrate it into cygwin". Would that mean copying the file into a cygwin directory? Anything else? Or do you just want to link with the library, in which case you don't need to integrate it at all, whatever that means, but just include a reference to the library in the link line, e.g.

    gcc myprog.c somelib.a -L/foo/bar -o myprog

    This will compile myprog.c, link it with somelib.a and write the myprog executable. -L specifies where the linker should look for libraries, in this case I'm assuming /foo/bar/somelib.a exists.

    (You could just do "gcc myprog.c /foo/bar/somelib.a -o myprog" but this gets tedious if you have loads of libraries to include from /foo/bar.)
     

Share This Page