[SOLVED c++] making a library ?
hi all,
i am writing a simple graphical application (based on gtk+) and i have couple of classes handling data management and drawing data (e.g. points in XY coord system).i want to create a simple library from these classes so it can be used not only for this certain project.
i am wondering how can i do that ? it is supposed to be a linux library, (on windows i could manage to do smth with vs2008 but i am not very profound of linux) and any help will be greatly appreciated.
best,
y.
[Edited by - DpakoH on July 31, 2008 4:37:08 AM]
Here is what you do for a static library:
That should at least get you started.
- Compile all of your code to object files:
gcc -c file1.c
gcc -c file2.c
... - Create an archive containing all of the object code:
ar rcs libraryname.a file1.o file2.o ... - Create an index for the library:
ranlib libraryname.a - Link new code to your library:
gcc libraryname.a code_that_uses_lib.c
That should at least get you started.
You shouldn't need to use ranlib if you used rcs or -rcs.
IIRC the 's' parameter already builds the index.
That is unless you're using an old version of ar.
IIRC the 's' parameter already builds the index.
That is unless you're using an old version of ar.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement