Re: [Dev-C++] include of selfcreated libraries
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Luigi S. <gi...@li...> - 2002-11-30 17:22:11
|
On Wed, Nov 27, 2002 at 12:17:44PM +0100, Frank Wagner wrote: > Hello, > > I wrote some classes that I don't want to include to new projekts every > time. So I created a directory ../inlcude and put in the foo.h files > containing the classes. Then I compiled the the foo.cpp building a > library named foo.a. > At the linker options I put in a -l foo.a but while compiling a new > projekt that sould use that new library I get a linker error. > What is neccessary to linkt the lib file? Is it neccessary to name the > libfile libfoo.a or someone else ?? > > Any suggestions?? Whats with the foo.so is this essential? > > I hope somewone can give me a hint. > > Greetings > > Frank Hi Frank, I assume you are using linux (because of the "../include" you wrote). As you surely know, libraries come in two flavors: static and shared. Generally, static ones are name "libfoo.a", while shared ones are named "libfoo.so". Shared libraries are called "dynamic link libraries" in the Microsoft world. There are 2 ways to link a "main" against some (static) library (assuming that the library is located in the same directory as the "hello.c" file): - using the command "cc -o hello hello.c libfoo.a" - using the command "cc -o hello hello.c -lfoo -L." Hope the above is of help. -- >> gisan >> |