Thread: A real program

  1. #1
    Registered User
    Join Date
    Mar 2007

    A real program

    I have a question about how "real" programs are created. I'm trying to understand C so i went to sourceforge and download a MUD (multi user dungeon) written in C.
    When I looked in the .zip I noticed that there were many,many .c files. Why are there so many .c files in most programs? Why not write the program in one .c file?

    I know there is a reason that it is done this way,I just don't know why? Can someone explain. How are all these different files combined to create an .exe?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Who in their right mind wants to deal with one 30000 line file?

    I'm sure someone on the internet has posted the steps needed to make an executable (compile, assemble, link).

    (Plus this way you only have to recompile the one file that changes, when the inevitable happens; and files can be transferred bodily from one project to another.)

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > How are all these different files combined to create an .exe?
    Usually, there's a top-level readme.txt file, and a top-level file called "Makefile".

    You read the readme.txt, then type 'make' at the command line and go find something else to do for a while.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Mar 2007
    Ok, I've seen make files in my IDE. Netbeans requires you to make a project for your code- in this project are several files-.c,make and a few others

  5. #5
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    London, UK
    Quote Originally Posted by tabstop View Post
    Who in their right mind wants to deal with one 30,000 line file?
    Urgh, I have to maintain one of those and I can tell you it's not fun.

    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  3. a tutorial on a voice communications program
    By Geo-Fry in forum C++ Programming
    Replies: 5
    Last Post: 08-12-2003, 07:31 AM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM