Could I create my own library to include in programs?

This is a discussion on Could I create my own library to include in programs? within the C++ Programming forums, part of the General Programming Boards category; I was wondering if I can assemble and compiler a code library of the most used functions I use. For ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    9

    Question Could I create my own library to include in programs?

    I was wondering if I can assemble and compiler a code library of the most used functions I use. For example I am currently trying to develop a low-level digital logic circuit simulator and I have created the code for the logical gates AND, OR, NOT, XOR...Instead of including their prototypes and code each time, how could I just write let's say #include <loggates.h> and have them ready?
    Thanks in advance!

    P.S: STOP THE WAR IN IRAQ! DROP BUSH, NOT BOMBS!

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Code:
    func.h.....
    
    int func1();
    int func2();
    int func3();
    Code:
    func.cpp
    
    #include "func.h"
    
    int func1()
    {
    // impl
    }
    
    int func2()
    {
    //impl
    }
    
    int func3()
    {
    //impl
    }
    Code:
    main.cpp
    
    #include "func.h"
    int main()
    {
    int a=func1();
    int b=func2();
    int c=func3();
    return 0;
    }
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Include some function form library
    By thepolo in forum C Programming
    Replies: 4
    Last Post: 05-24-2009, 05:11 PM
  2. Programs Only Run on My Machine!
    By pobri19 in forum Windows Programming
    Replies: 20
    Last Post: 04-23-2009, 06:25 PM
  3. Unable to open include file SDL_audio.h
    By rraj.be in forum C Programming
    Replies: 2
    Last Post: 06-28-2008, 08:04 PM
  4. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  5. Multiple include problem
    By VirtualAce in forum Game Programming
    Replies: 13
    Last Post: 02-04-2006, 05:09 PM

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