From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Libraries Date: Tue, 31 Mar 1998 19:11:44 -0500 Organization: Two pounds of chaos and a pinch of salt. Lines: 34 Message-ID: <35218640.3A6A@cs.com> References: <1998040100030900 DOT TAA22192 AT ladder03 DOT news DOT aol DOT com> NNTP-Posting-Host: ppp225.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk HackerOC3 wrote: > > I'm pretty sure this is a stupid question, but as they say on south park, there > are no stupid questions, only stupid people who ask the questions. I guess > that would make me...er, nevermind. > > Anyways, I'm trying to make a library. I have 4 .c files with functions in > them and 1 .h file with all the defines, prototypes, structs, typedefs, etc. > When I try to compile everything into library.a, it doesn't use the stuff from > my header file. How do you go about making libraries? You'll probably tell me > to look in the FAQ, which I already have, but I'm still having problems You don't use header files to make a library. Header files are #included by external programs to tell them what is in the library. If you specify a library as the target of a project in RHIDE, it will automatically compile all source files to object code and use 'ar' to put them into the library. If you run from the command line, you should compile to objects with the '-c' flag, and then use "ar rvs libmylib.a obj1.o obj2.o obj3.o ..." to put them into a library. To use a library, you should have one or more header files that declare the functions and variables in that library, and then #include them in your programs. Finally, you must tell gcc to link the library to the final executable. -- John M. Aldrich, aka Fighteer I UIN# 7406319 -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s+:- a-->? C++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---) O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++ e(*)>++++ h!() !r !y+() ------END GEEK CODE BLOCK------