954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Create your own Library

Plz help me out with this :

This is saved as myfuncs.c

int factorial(int num)
{
           int i, f = 1;
           for(i = 1; i <= num; i++)
           f = f*i;
           return(f);
}
int prime(int num)
{
          int i;
          for(i = 2; i < num; i++)
          {
                if(num%i == 0)
                {
                         printf("%d is not a Prime Number",num);
                         break;
                }
          }
                if(i == num)
                printf("%d is Prime Number",num);
return 0;
}
int fibonacci(int num)
{
              int z, x=0, y=1, i;
              printf("FIBONACCI SERIES :\n");
              for(i=1; i<=num; i++)
              {
                    z= x+y;
                    x=y;
                    y=z;
                    printf("%d ",x);
              }
return 0;
}


and this is saved as a header file myfuncs.h

int factorial(int);
int prime(int);
int fibonacci(int);


Now, in Turbo C++ there is option"Application" on Menu Bar and thereafter we select "Library".

But in Dev C++ there is no such option like "Application".
Plz help me out with this. I just need to make this code a library file.
I googled but cant find the exact answer. :(

Shardendu
Newbie Poster
19 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

Drop both those compilers because they are too old. Get free Code::Blocks (with MinGW compiler) or VC++ 2010 Express. You can easily compile libraries with either of those compilers/IDEs.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Thanks for your suggestion. :)
But I also want to know how to compile library in Dev C++ as i have to give exam according to Dev and Turbo C++ :(

Shardendu
Newbie Poster
19 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

File->New Project->Static Library.
It will create an .a file.
Reference that project in your linker libraries in your next project.

DeanMSands3
Junior Poster
185 posts since Jan 2012
Reputation Points: 37
Solved Threads: 26
 

Thanx a lot.. :)

Shardendu
Newbie Poster
19 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You