C/C++ beginner Lvl 2

This is a discussion on C/C++ beginner Lvl 2 within the C++ Programming forums, part of the General Programming Boards category; I'm fairly advanced in my classes that I'm currently enrolled it and I decided I wanted to be a little ...

  1. #1
    Registered User
    Join Date
    Mar 2002

    C/C++ beginner Lvl 2

    I'm fairly advanced in my classes that I'm currently enrolled it and I decided I wanted to be a little further ahead of my classmates. Unfortunately, I do not know how to go about doing such a feat as my teacher doesn't quite understand what I'm asking.

    My best example for this is a unix program with a Makefile that builds multiple c/cpp files to object files and then creates the single binary file. I was wondering how I would go about doing this. Maybe even go as far as API/Lib programming kind of thing.

    I guess the basic thought on my mind is being able to make my programs more modular.
    Last edited by Raven; 03-12-2002 at 06:20 AM.

  2. #2
    To be more modular, place class/function declarations in header files and method/function definitions in c/cpp files. List the header files in the list of #includes in any program you wish to do so. If the header file is in the same directory/subdirectory as the executable file of the program, then use the double quote method for #includes, otherwise use the double angle braket syntax for listing #includes. The cpp file of the same name as the header file you listed in the #include will be automatically linked to the program for you. When you compile the program there will be a single binary executable file generated.

    If you try this I encourage you to look up inclusion gaurds and use them appropriately.

    The exception to the above rule is template classes where the method definitions need to be in the header file with the declarations, if you have gotten to the stage of using templated classes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Utter beginner question about using notepad for c++
    By Borodin in forum C++ Programming
    Replies: 8
    Last Post: 08-18-2008, 04:08 PM
  2. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 11:48 AM
  3. What are some good beginner programs I shouold make?
    By oobootsy1 in forum C# Programming
    Replies: 6
    Last Post: 08-09-2005, 02:02 PM
  4. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 10:21 AM

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