C++ Libraries

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kieran Simpson

    C++ Libraries

    I have written a set of C++ classes that I would like to compile into a
    library file, that then can be linked into other projects so I can use those
    classes. The only thing is that I am not to sure how make the classes into
    a library, and then how to consequently link them into my other projects.
    Can anybody point me in the right direction please. I want to statically
    link them so that the code is compiled into the app, because I don't want to
    mess with DLL's

    Thanks


  • Josephine Schafer

    #2
    Re: C++ Libraries


    "Kieran Simpson" <stupid_garbage @hotmail.com> wrote in message
    news:_2QMa.80$a %1.4726@nnrp1.o zemail.com.au.. .[color=blue]
    > I have written a set of C++ classes that I would like to compile into a
    > library file, that then can be linked into other projects so I can use[/color]
    those[color=blue]
    > classes. The only thing is that I am not to sure how make the classes[/color]
    into[color=blue]
    > a library, and then how to consequently link them into my other projects.
    > Can anybody point me in the right direction please. I want to statically
    > link them so that the code is compiled into the app, because I don't want[/color]
    to[color=blue]
    > mess with DLL's
    >[/color]

    Actually this is platform specific.

    I can talk about Windows platform though -
    Write your functions, compile the source files to object files. Then
    instead of linking, use lib.exe to create a library file.

    --
    With best wishes,
    J. Schafer


    Comment

    • Dhruv

      #3
      Re: C++ Libraries

      On Thu, 03 Jul 2003 16:29:08 +1000, Kieran Simpson wrote:
      [color=blue]
      > I have written a set of C++ classes that I would like to compile into a
      > library file, that then can be linked into other projects so I can use those
      > classes. The only thing is that I am not to sure how make the classes into
      > a library, and then how to consequently link them into my other projects.
      > Can anybody point me in the right direction please. I want to statically
      > link them so that the code is compiled into the app, because I don't want to
      > mess with DLL's
      >
      > Thanks[/color]

      Only compile the file, do not link it. Then, link the object files (.obj
      on windows, or .o on UNIX), and you have the binary ready. You will have
      to put the declarations in the headers (.h files), while definitions in
      the .cpp files and compile those .cpp files.

      -Dhruv.





      Comment

      Working...