A real program

This is a discussion on A real program within the C Programming forums, part of the General Programming Boards category; I have a question about how "real" programs are created. I'm trying to understand C so i went to sourceforge ...

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    43

    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
    Posts
    14,185
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    > 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.

    http://www.eng.hawaii.edu/Tutor/Make/1-3.html
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Mar 2007
    Posts
    43
    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
    Location
    London, UK
    Posts
    894
    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.

    QuantumPete
    "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, 06: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 Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

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