Makefile for shared library

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

    #1

    Makefile for shared library

    I'm not a Makefile expert. I have a real small program (just a
    main.cpp) that needs to tie into an existing library. Now other
    programs I've seen that use the library just do #include "Library.h"
    but and that works. Of course that doesn't work for me because when I
    do g++ main.cpp -o prog, it has no idea what to do with Library.h. I
    take a look at the other people's make files and it's absolute voodoo
    to me.

    So is there an easy way to write my makefile to use that library? so
    doing #include "Library.h" compiles? Thanks.
  • Travis

    #2
    Re: Makefile for shared library

    On Feb 14, 1:02 pm, Travis <travis.bow...@ gmail.comwrote:
    I'm not a Makefile expert. I have a real small program (just a
    main.cpp) that needs to tie into an existing library. Now other
    programs I've seen that use the library just do #include "Library.h"
    but and that works. Of course that doesn't work for me because when I
    do g++ main.cpp -o prog, it has no idea what to do with Library.h. I
    take a look at the other people's make files and it's absolute voodoo
    to me.
    >
    So is there an easy way to write my makefile to use that library? so
    doing #include "Library.h" compiles? Thanks.
    Also. I noticed that in the directory for the library that other
    people wrote, there is a MyLibrary.a file. Is that all I need to tie
    into? Not sure what the compile line is.

    Comment

    • Victor Bazarov

      #3
      Re: Makefile for shared library

      Travis wrote:
      I'm not a Makefile expert. [..]
      Makefiles are offtopic. See the -l (that's a lowercase L)
      compilation switch for your compiler.

      V
      --
      Please remove capital 'A's when replying by e-mail
      I do not respond to top-posted replies, please don't ask


      Comment

      • Travis

        #4
        Re: Makefile for shared library

        Okay. Sorry for not RTFM. I'm trying. And sorry for being off topic.

        Cheers.

        Comment

        • James Kanze

          #5
          Re: Makefile for shared library

          On Feb 14, 10:18 pm, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
          Travis wrote:
          I'm not a Makefile expert. [..]
          Makefiles are offtopic. See the -l (that's a lowercase L)
          compilation switch for your compiler.
          That depends on the compiler. -l is traditionally the option
          under Unix (where it also involves special naming conventions,
          and other things), but I don't think it works with VC++.

          Normally, a "component" will be delivered as a library and a set
          of header files. You install it somewhere; you then have to
          inform the compiler where to look for the headers (-I or /I are
          frequently the option for this) and to use the library when it
          links---specifying the full path to the library will generally
          work. (Even under Unix, I find that I only use -l for system
          libraries.)

          You might also have to use different options according to
          whether you want to link the library statically or not.

          --
          James Kanze (GABI Software) email:james.kan ze@gmail.com
          Conseils en informatique orientée objet/
          Beratung in objektorientier ter Datenverarbeitu ng
          9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

          Comment

          Working...