
C problem involving creating creating your own .LIB file
Quote:
> hello ppl.
> I just recently created a .LIB file. using TLIB when copiling the code(main
> program) it refuses to liknk. TLINK reported error
> what should i do.
> here is the source code.
The short answer is that since you never define nc(), the linker can't
find it. Write nc() if you expect to link it.
There are other issues here, however. The use of <conio.h>, <dos.h>,
_Cdecl, cdecl, gotoxy, and textcolor all mark this as non-standard C.
Questions about the "Borland-C language" are better asked in the Borland
newsgroups where the Borland experts hang out.
The use of an implicit return type on tb() is a bad idea.
The K&R code in pwr2.c should be avoided:
Quote:
> tc(clr)
> int clr;
> { textcolor(clr); }
make this
void tc(int clr)
{
textcolor(clr);
}
or even just
#define TC(clr) textcolor((clr))
But these efforts to avoid typing a few characters seem silly.
In test.c
Quote:
> #include <pwr2.h>
> main()
again, make the return type explicit. Implicit returns types are a
bad
idea:
int main(void)
Quote:
> {
> nc();
> tc(0);
It is nice to
return 0;
Quote:
> }