gcc/g++ help needed

This is a discussion on gcc/g++ help needed within the C++ Programming forums, part of the General Programming Boards category; Okay, I usually use VC++ on Windows but I'm starting to code on Linux as well -- thus, I have ...

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    5

    gcc/g++ help needed

    Okay, I usually use VC++ on Windows but I'm starting to code on Linux as well -- thus, I have to use gcc. My problem is that I can't figure out how to compile/link multiple source files from the command line.

    Now, before anyone tells me to RTFM, let me say this: I've read several tutorials on the web, some have suggested compiling my source files as modules with the -c switch but that isn't working. I've tried to read the man pages as well but they're written in very stiff language and I doubt I'll find what I need in them.

    So if anyone could help me out here I'd be appreciative, thanks!

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >I doubt I'll find what I need in them
    Everything you need is in the man pages if you know how to look for it.

    >My problem is that I can't figure out how to compile/link multiple source files from the command line.
    Code:
    // All in one go:
    $ gcc -o myprog driver.c a.c b.c
    
    // Separate compilation
    $ gcc -c a.c
    $ gcc -c b.c
    $ gcc -o myprog driver.c a.o b.o
    My best code is written with the delete key.

  3. #3
    Master of the Universe! velius's Avatar
    Join Date
    Sep 2003
    Posts
    219
    Deleted response. Prelude beat me to it.
    While you're breakin' down my back n'
    I been rackin' out my brain
    It don't matter how we make it
    'Cause it always ends the same
    You can push it for more mileage
    But your flaps r' wearin' thin
    And I could sleep on it 'til mornin'
    But this nightmare never ends
    Don't forget to call my lawyers
    With ridiculous demands
    An you can take the pity so far
    But it's more than I can stand
    'Cause this couchtrip's gettin' older
    Tell me how long has it been
    'Cause 5 years is forever
    An you haven't grown up yet
    -- You Could Be Mine - Guns N' Roses

  4. #4
    Registered User
    Join Date
    Dec 2003
    Posts
    5
    thanks a lot, appreciate it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. free needed or not?
    By quantt in forum Linux Programming
    Replies: 3
    Last Post: 06-25-2009, 10:32 AM
  2. C Programmers needed for Direct Hire positions
    By canefan in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 09-24-2008, 12:55 PM
  3. lock needed in this scenario?
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-25-2008, 08:22 AM
  4. C++ help needed
    By Enkindu in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-01-2004, 12:24 AM
  5. semi-colon - where is it needed
    By kes103 in forum C++ Programming
    Replies: 8
    Last Post: 09-12-2003, 06:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21