1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

use .a object in cygwin

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

  1. davidhai

    davidhai New Member

    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

    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