Linking multiple .c/pp files together

This is a discussion on Linking multiple .c/pp files together within the Game Programming forums, part of the General Programming Boards category; Simple enough question, right? How do you set it up so you can compile several .c or .cpp files into ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    2

    Question Linking multiple .c/pp files together

    Simple enough question, right? How do you set it up so you can compile several .c or .cpp files into one program... so say you can have certain types of functions in certain types of files (eg: fight functions in fight.c, movement in movement.c, etc)... I'm looking for the specifics of doing this in MSVC++ 6, though I don't really know how far this procedure differs between compilers. Thanks in advance.

  2. #2
    Unregistered
    Guest
    I use MSVC 5/97 pro (must be similar to 6)

    Click FILE, NEW. Then the PROJECT tab.
    Create a new WIN32 exe/app.
    This will give you a workspace/project.
    On the PROJECT menu add the files.
    Compile each / build all.

    You will need conditional compilation if you have .h files included in more than one source file

    Code:
    #ifndef   MY_HEADER_FILE
    #define   MY_HEADER_FILE
    
    //all the header
    
    #endif
    this allows multiple files to use the same header without including it more than once.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. header files and multiple files
    By Dedalus in forum C Programming
    Replies: 5
    Last Post: 06-16-2009, 09:21 AM
  2. Windows shell commands - multiple files
    By Magos in forum Tech Board
    Replies: 3
    Last Post: 02-28-2006, 12:56 AM
  3. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 10:46 AM
  4. Linking multiple source files: Undefiled Reference to...
    By Inquirer in forum C++ Programming
    Replies: 4
    Last Post: 05-03-2003, 05:47 PM
  5. Replies: 1
    Last Post: 05-01-2003, 02:52 PM

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