C Library的做成
戻る
lib /?
Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
usage: LIB [options] [files]
options:
/CONVERT
/DEBUGTYPE:CV
/DEF[:filename]
/EXPORT:symbol
/EXTRACT:membername
/INCLUDE:symbol
/LIBPATH:dir
/LINK50COMPAT
/LIST[:filename]
/MACHINE:{ALPHA|ARM|IX86|MIPS|MIPS16|MIPSR41XX|PPC|SH3|SH4}
/NAME:filename
/NODEFAULTLIB[:library]
/NOLOGO
/OUT:filename
/REMOVE:membername
/SUBSYSTEM:{NATIVE|WINDOWS|CONSOLE|WINDOWSCE|POSIX}[,#[.##]]
/VERBOSE
程序和Header文件
// lib1.c
#include
void cls(void)
{
printf("This is cls.\n");
}
void locate(int x, int y)
{
printf("This is locate.\n", y+1, x+1);
}
void color(int n)
{
printf("This is color.\n", n);
}
// lib2.c
#include
#include
void putd(char *msg, int d)
{
printf("%s%d",msg,d);
}
int getd(char *msg)
{
char buf[20];
printf("%s", msg);
return atoi(gets(buf));
}
// lib1.h
void cls(void);
void locate(int x, int y);
void color(int n);
void putd(char *msg, int d);
int getd(char *msg);
// libtest1.c
#include
#include "lib1.h"
main()
{
int a;
cls();
color(3);
locate(0,5);
a=getd("Please input a number:");
color(7);
putd("The Number=",a);
}
編譯執(zhí)行語句
C:\test>cl /c lib1.c
C:\test>cl /c lib2.c
C:\test>lib /out:libs.lib lib1.obj lib2.obj
C:\test>lib /list libs.lib
Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
lib1.obj
lib2.obj
C:\test>cl libtest1.c libs.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
libtest1.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:libtest1.exe
libtest1.obj
libs.lib
戻る
杭锦后旗|
马山县|
彰武县|
平顺县|
施甸县|
泌阳县|
铜梁县|
民勤县|
太湖县|
毕节市|
威信县|
宁乡县|
许昌县|
永丰县|
阳泉市|
呼图壁县|
彭阳县|
上高县|
古丈县|
三原县|
宿州市|
西贡区|
南丹县|
红原县|
双鸭山市|
礼泉县|
中阳县|
田东县|
阿鲁科尔沁旗|
嘉义市|
土默特左旗|
西昌市|
朝阳区|
淮北市|
昔阳县|
紫云|
徐州市|
厦门市|
平顶山市|
古丈县|
永兴县|