Thread: Add User-Defined Functions to Library Using Code::Blocks

  1. #1
    Registered User
    Join Date
    Aug 2019
    Posts
    1

    Add User-Defined Functions to Library Using Code::Blocks

    Hi,

    I am new here and new in learning C. I'm using the book Let Us C to learn how to program in C. The book uses TurboC but I decided to go for Code::Blocks isntead. I am at the chapter where you can add your custom function to a library. The instruction is written for TurboC though. Can you help me on how to do it in Code::Blocks? I tried to look it up but I can't find a good resource that can teach me on how to do it.

    Here's what I have so far. I have a file called fact.c with the following codes:

    Code:
    int factorial ( int num )
    {
     int i, f = 1 ;
     for ( i = 1 ; i <= num ; i++ )
     f = f * i ;
     return ( f ) ;
    }
    What I need to do next is add this file to a math library.

    Thanks your for help.

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,714
    I'm just going to tell you to get a different book. "Let us C" is outdated and full of mistakes.

    Now, about your question, CodeBlocks has an option to compile as a static library, at Project->Properties...->Build targets->Type:
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. User-Defined Static Library Not Linking Against Program
    By QuadraticFighte in forum C Programming
    Replies: 2
    Last Post: 10-15-2010, 02:10 PM
  2. User-defined functions
    By naya22 in forum C++ Programming
    Replies: 6
    Last Post: 04-10-2007, 11:25 AM
  3. User defined functions
    By alexpos in forum C Programming
    Replies: 2
    Last Post: 10-23-2005, 02:53 PM
  4. New to user defined functions
    By Extropian in forum C Programming
    Replies: 4
    Last Post: 08-15-2005, 10:45 PM
  5. Help! User defined functions
    By AdrenalinFlow in forum C Programming
    Replies: 3
    Last Post: 02-22-2003, 07:36 PM

Tags for this Thread