Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   use .a object in cygwin (http://www.go4expert.com/forums/object-cygwin-t14848/)

davidhai 29Oct2008 07:26

use .a object in cygwin
 
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.

xpi0t0s 29Oct2008 13:52

Re: use .a object in cygwin
 
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.)


All times are GMT +5.5. The time now is 16:22.