Message-ID: <004101bf750b$127af000$61ebc8cd@escape.ca> From: "Nick J Chackowsky" To: References: <11 DOT fc6abc DOT 25d3b7c8 AT aol DOT com> Subject: Re: Linking to my library sucks! Help! Date: Fri, 11 Feb 2000 21:41:37 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Reply-To: djgpp AT delorie DOT com Aha... I had just posted a similar problem, but got no answers. FINALLY found a reference in, of all places, the FAQ. The order of your libraries matters, it turns out. You should always do it in the order: anyobjectfiles.o -lyourlib -lyournextlib -lstdcxx That is, with stdcxx LAST, and any object files FIRST, and your own libary file(s) sandwiched between. It worked for me (after I'd pulled out most of my hair). The FAQ reference is 8.10. Let me know if this helps! Nick. ----- Original Message ----- From: Newsgroups: comp.os.msdos.djgpp To: Sent: Thursday, February 10, 2000 12:42 AM Subject: Linking to my library sucks! Help! > I know that everybody and their mother has already complained at some > point about not being about to link to a library, but I really couldn't > resist - I have read every FAQ and mail archive I could find about the topic, > yet I can't find any specific answers on how to successfully link programs to > a library I have created. > My library consists of header file, MAPS.H, which defines some constants > and some classes, and the other file is souce code, MAPS.CPP, which includes > MAPS.H and defines all of the member functions declared in MAPS.H. The > library builds perfectly into LIBMAPS.A. > However, problems begin when I try linking this library to my game. The > game includes MAPS.H, the library is checked off and spelled correctly (minus > the "lib" part, just "maps") since I'm using RHIDE, it's located in the > correct directory, and the program compiles fine, but come the linking stage > I get several "undefined reference" errors of my class member functions that > are defined in the library. > I've tried linking the program from the command line and it gives me the > same errors, so I dont think anything is wrong with RHIDE. I've tried adding > the library to my project (instead of checking it off in the Library menu) > but that didnt do anything. I'm pretty sure there's nothing wrong with my > code because if I put the same member function definitions and constants > directly into my one program source file instead of trying to link to the > library, the program builds and runs perfectly. > I'm very stumped and I would hate to continue developing my game having > to re-compile EVERYTHING each time, so any help that anybody could give would > be greatly appreciated. Thanx! > > -Kevin >