Linking MANY object files together, many times - Questions

This is a discussion on Linking MANY object files together, many times - Questions ; I know there's a really easy way to do this but I can't figure out how to do it, since my linux experience is limited. Let's say that for example I have many object files that I link with my ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Linking MANY object files together, many times

  1. Linking MANY object files together, many times

    I know there's a really easy way to do this but I can't figure out how
    to do it, since my linux experience is limited.

    Let's say that for example I have many object files that I link with
    my programs really frequently (almost every time).

    What can I do to prevent me from doing all this?

    Here's what I've thought of but I don't know how to implement it

    put the names of the object files in some variable (e.g. MYOBJECTS)
    and then do

    g++ -o abc abc.o MYOBJECTS

    How can I make that work? How can I make that MYOBJECTS variable not
    be deleted every time I reboot?

    TIA,
    cmad

  2. Re: Linking MANY object files together, many times

    On 5 Jan 2004 09:51:12 -0800, Chris Mantoulidis wrote:
    > I know there's a really easy way to do this but I can't figure out how
    > to do it, since my linux experience is limited.
    >
    > Let's say that for example I have many object files that I link with
    > my programs really frequently (almost every time).
    >
    > What can I do to prevent me from doing all this?
    >
    > Here's what I've thought of but I don't know how to implement it
    >
    > put the names of the object files in some variable (e.g. MYOBJECTS)
    > and then do


    export MYOBJECTS=z,y,z

    >
    > g++ -o abc abc.o MYOBJECTS

    g++ -o abc abc.o $MYOBJECTS
    >
    > How can I make that work? How can I make that MYOBJECTS variable not
    > be deleted every time I reboot?


    depends on the shell. Try doing a
    man $(basename $SHELL)
    or
    man `basename $SHELL`

    useually it is ~/.bash_profile for linux bash


    Today's Tip of the Day, very large
    Frequently Asked Questions (faq) Search engine:

    http://groups.google.com/advanced_group_search
    set variable permanent in the first box
    *linux* in the Newsgroup, pick English

    Results 1 - 10 of about 500. Search took 1.28 seconds.

  3. Re: Linking MANY object files together, many times

    Chris Mantoulidis wrote:
    > I know there's a really easy way to do this but I can't figure out how
    > to do it, since my linux experience is limited.
    >
    > Let's say that for example I have many object files that I link with
    > my programs really frequently (almost every time).
    >
    > What can I do to prevent me from doing all this?


    You can't do anything, if you don't link these other .o
    files you can't get an executable.

    You can make it easier though.

    "man ld"
    and learn how to make your own libraries.

    "man make"
    and learn how to control your compilation process.

    > How can I make that work? How can I make that MYOBJECTS variable not
    > be deleted every time I reboot?


    In .bash_profile:

    MYOBJECTS=...
    export MYOBJECTS


  4. Re: Linking MANY object files together, many times

    On 5 Jan 2004 09:51:12 -0800, cmad_x@yahoo.com (Chris Mantoulidis) wrote:

    > What can I do to prevent me from doing all this?


    ..... use "make"

    --
    << http://michaeljtobler.homelinux.com/ >>
    What color is a chameleon on a mirror?

  5. Re: Linking MANY object files together, many times


    "Chris Mantoulidis" wrote in message
    news:a8587dd9.0401050951.374af5f@posting.google.co m...
    > I know there's a really easy way to do this but I can't figure out how
    > to do it, since my linux experience is limited.
    >
    > Let's say that for example I have many object files that I link with
    > my programs really frequently (almost every time).
    >
    > What can I do to prevent me from doing all this?
    >
    > Here's what I've thought of but I don't know how to implement it
    >
    > put the names of the object files in some variable (e.g. MYOBJECTS)
    > and then do
    >
    > g++ -o abc abc.o MYOBJECTS
    >
    > How can I make that work? How can I make that MYOBJECTS variable not
    > be deleted every time I reboot?


    By using "make" and files call "makefile" (or Makefile) that control make.
    You should use make, as it detects the case that a source file has a more
    recent modification date/time than the .o file ...Currently if you edit the
    source code but forget to modify the .o file, then you might take a while to
    notice that you have neglected to produce the .o file from the source
    file...






    >
    > TIA,
    > cmad




  6. Re: Linking MANY object files together, many times

    "Kevin D. Snodgrass" wrote in message news:<3FF9AE48.7060008@spamcop.net>...
    > Chris Mantoulidis wrote:
    > > I know there's a really easy way to do this but I can't figure out how
    > > to do it, since my linux experience is limited.
    > >
    > > Let's say that for example I have many object files that I link with
    > > my programs really frequently (almost every time).
    > >
    > > What can I do to prevent me from doing all this?

    >
    > You can't do anything, if you don't link these other .o
    > files you can't get an executable.


    Yeah that's what I mean, the below (what you wrote). I know I can't
    make an executable without object files (duh)

    >
    > You can make it easier though.
    >
    > "man ld"
    > and learn how to make your own libraries.
    >
    > "man make"
    > and learn how to control your compilation process.
    >
    > > How can I make that work? How can I make that MYOBJECTS variable not
    > > be deleted every time I reboot?

    >
    > In .bash_profile:
    >
    > MYOBJECTS=...
    > export MYOBJECTS


+ Reply to Thread