Thread: Newbie Question: making a lib

  1. #1
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Buffalo, NY

    Newbie Question: making a lib

    Okay, I've made this really cool graphics library for Borland Turbo C++ 3.1. The thing is though if i want to give it to other people, they can just take all of my code since all of it is just header files. Does anyone know how to put all of those header files into a .lib so people can use it and die?

    This is dos.

  2. #2
    Registered User
    Join Date
    Dec 2001
    You have to distribute the .h files with your lib otherwise people can't use your functions (take a look at the windows API for example).

    If the program doesn't know what the function is or what it looks like.. how the hell is it going to use it?

    So if you want to distribute it... you'll have to move the body of your code to .cpp files or something and just keep the function declarations in the .h files.

    Man, you really need to reconsider your programming style if you have EVERYTHING in header files... that's really bad form!

    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  3. #3


    Do you mean that you want other to be able to use your file, but not able to read what's inside? Do you got class in you file?

    If both of the answer is correct, then I hope your question be solved asap. Because I have the same problem recently.

  4. #4
    Registered User JasonLikesJava's Avatar
    Join Date
    Mar 2002

    Red face

    After you do what Uraldor said you compile all of those into objects and then you can compile a library with

    ar cru mylib.a objects.o

    that is "ar.exe" or whatever library tool you have with borland... it might be tlib.exe

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. Newbie with Very Newbie Question
    By Jedi_Mediator in forum C++ Programming
    Replies: 18
    Last Post: 07-01-2008, 08:00 AM
  3. newbie: array question :(
    By cstudent in forum C Programming
    Replies: 2
    Last Post: 04-09-2008, 06:46 AM
  4. Total Newbie Question
    By Kid A in forum C++ Programming
    Replies: 4
    Last Post: 06-22-2006, 05:36 AM
  5. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM