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. :(

Recommended Answers

All 4 Replies

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.

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++ :(

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

Thanx a lot.. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.