Thread: Project feature in compliers

  1. #1
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

    Project feature in compliers

    If memory serves the project ability allowed you to take several C source files and compile them into one exe.

    My questions are:
    1) Is that correct?
    2) Will every source file have int main() or just one?
    3) Is it worth using?
    4) Is there a better way?

    To give a run down of why I'm asking:
    Developing a text based game to help get myself back into programming.

    I have been building it in modules (i.e. The battle code, the exploration code, etc) and have gotten each one to work. The problem comes when I copy them into my the actual game source file, it just becomes so big its a pain to scroll up and down, so I'm trying to cut it down into more managible blocks.

    One thing I did for some of the smaller stand alone functions (ie the RNG) was to put them in a header file and #include it.

    Well thanks in advance for any suggestions.

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    61
    1) Yes, this could be done manually using custom compiler/linker options, or through the external program (make is one).

    2) The binary will have only one main function.

    3) Not sure if it's available in win32 palatform, but in UNIX, make the de facto standard for compiling projects.

    4) None that I'm aware of.

    HTH,
    Last edited by cc0d3r; 08-05-2003 at 10:49 PM.
    $ENV: FreeBSD, gcc, emacs

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Thanks for the info. One more question: Do global variables work when using projects?

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    61
    Originally posted by Thantos
    Thanks for the info. One more question: Do global variables work when using projects?
    Yes, but if the you're referencing the global var that is defined in a separate file, then you need to declare it locally using extern keyword.
    $ENV: FreeBSD, gcc, emacs

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem Displaying a Struct
    By rockstarpirate in forum C++ Programming
    Replies: 16
    Last Post: 05-05-2008, 09:05 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. Dynamic Binding
    By gpr1me in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2006, 09:01 AM
  4. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM