delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/23/09:53:32

Date: Tue, 23 Jan 1996 15:13:16 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Werner Drescher <k1950 AT fh-sw DOT de>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Liberies

On Tue, 23 Jan 1996, Werner Drescher wrote:

> I wrote some own class-functions in C++ and now I want to make a 
> libery-file out of them. I have the C++ file *.cc the header-file *.h and 
> I want now the *.a file so that I can link it with the -l option.
> How can I do this ?

Compile your file with `gcc -c file.cc', then use the program called `ar',
like this: 

	ar rvs libmylib.a file.o

You can then link against this library like this:

	gcc main.c sub.c -o myprog -lmylib

Note that your library name *must* begin with `lib' for the linker to 
find it when you use -l switch.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019