A
ashu
lets look at the code given below
here i m trying to do mudular programming
/* this is my main prog.*/
/*mmod.c*/
#include<stdio.h>
#include "mod1.h"
int main(void)
{
int n;
puts("enter the value of n");
scanf("%d",&n);
printf("the square of %d is :- %ld",n,sqr(n));
return 0;
}
/*this is my secondary module */
/*mod1.c*/
#include "mod1.h"
long sqr(int x)
{
return ((long)((x)*(x)));
}
/*this is my header file*/
/*mod1.h*/
long sqr(int x);
when i compile main & secondary module,every thing is ok, but as i am
trying to link them,there is a linker error i.e,undefined symbol _sqr
in mmod.exe
here i m trying to do mudular programming
/* this is my main prog.*/
/*mmod.c*/
#include<stdio.h>
#include "mod1.h"
int main(void)
{
int n;
puts("enter the value of n");
scanf("%d",&n);
printf("the square of %d is :- %ld",n,sqr(n));
return 0;
}
/*this is my secondary module */
/*mod1.c*/
#include "mod1.h"
long sqr(int x)
{
return ((long)((x)*(x)));
}
/*this is my header file*/
/*mod1.h*/
long sqr(int x);
when i compile main & secondary module,every thing is ok, but as i am
trying to link them,there is a linker error i.e,undefined symbol _sqr
in mmod.exe