vc6.0 中使用lib文件 使用库的方法如下:
1. 包含库的头文件(把库的头文件包含到项目中)
在应用程序工程中使用
#include "file path"
file path可以为绝对路径,也可以为相对于工程所在目录的相对路径
如果头文件比较多,可以在project&settings&c/c++&preprocessor的Additional include directories中填入你的头文件所在目录
2. 导入lib库。导入的方法很多
方法1) 直接用project&add to project&files的方式将.lib加入工程
方法2) 使用#pragma指令,如
#pragma comment(lib, "your lib path and name")
与前面头文件一样,也可以不在这里指定路径,而是在project&settings&link&input的Additional library path中输入.lib文件所在路径
方法3) 还可以在project&settings&link&general的ojbect/library modules中输入.lib的名字
3. 编译执行程序,如果是静态库,编译后就可直接执行(lib的二进制代码和用户代码一起链接到了exe文件中)
如果是动态库,需要将dll放到可执行文件所在目录下,或者系统目录下,如system32或者windows目录,或者其它任何一个位于环境变量PATH中的目录
Note:.h头文件是不能编译的,所以lib文件里是不包含.***件的,如果你生成.lib文件的源程序里有.***件和.cpp(.c)文件,除了加入lib文件(上面的三种方法,个人建议第2种)外,你还需要手动的将.***件加入到新项目里, 如果你生成.lib的源代码只有.c或.cpp文件,则不需要。
===========================================================
lib的一般使用
本文介绍用VC建立static lib,并且如何使用自己创建的库。
新建一个win32 static library工程,默认&ok&-〉&finish&即可
新建文件add.cpp和add.h到此工程
add.***件如下:
----------------------------------
#include &stdio.h&
int add(int x, int y);
----------------------------------
add.cpp文件内容如下:
-----------------------------------------------------------------
#include "add.h"
int add(int x, int y)
printf("This sum is caculated in a static lib:");
return (x+y);
------------------------------------------------------------------
编译库,成功编译后,可以在工程的&debug&文件夹中得到libproject.lib文件
另外新建一个工程来使用这个lib,在这,我建立一个win32 console工程,命名为&libtest&,将add.h和生成的libproject.lib文件拷贝到libtest工程目录下,在libtest工程中添加库的add.***件,
在test.cpp文件内容如下:
----------------------------------------------
#include "add.h"
#pragma comment(lib,"libproject.lib")
void main()
int x=1, y=2;
printf("%d/n",add(x,y));
-----------------------------------------------
编译libtest工程,并运行就可以看到输出结果如下:This sum is caculated in a static lib:3转载自:
阅读(...) 评论()iLBCTap here to compare the top VoIP providersTap here to hide the top VoIP Providers
is a VOIP codec originally created by
but made available (including its source code) under a restricted but free and fairly liberal license, including permission to modify.Quoted from: What is iLBC? iLBC (internet Low Bitrate Codec) is a FREE speech codec suitable for robust voice communication over IP. The codec is designed for narrow band speech and results in a payload bit rate of 13.33 kbit/s with an encoding frame length of 30 ms and 15.20 kbps with an encoding length of 20 ms. The iLBC codec enables graceful speech quality degradation in the case of lost frames, which occurs in connection with lost or delayed IP packets.Features Bitrate 13.33 kbps (399 bits, packetized in 50 bytes) for the frame size of 30 ms and 15.2 kbps (303 bits, packetized in 38 bytes) for the frame size of 20 ms Basic quality higher than , high robustness to packet loss Computational complexity in a range of G.729A Royalty-free CodecNews
- iLBC no longer included with Asterisk source (1.4.19 and 1.6); to install ilbc codec translation:cd /usr/src/asterisk/./contrib/scripts/get_ilbc_source.shcp /usr/src/asterisk/contrib/scripts/codecs /usr/src/asterisk/codecs/./menuselect/menuselectselection 4 (codecs)to make sure ilbc selectedexit + savemakeasterisk -rvvvvvvvvvvvvload codec_ilbc.socore show translations
- Internet Engineering Task Force (IETF) has approved standardization of the iLBC codec.
- GIPS to Provide Major DSP Chip Manufacturer Infineon with iLBC Speech Codec to Accelerate Time-to-Market
- GIPS iLBC has been specified as a mandatory codec in the recently released
is a VOIP codec originally created by
but made available (including its source code) under a restricted but free and fairly liberal license, including permission to modify.Quoted from: What is iLBC? iLBC (internet Low Bitrate Codec) is a FREE speech codec suitable for robust voice communication over IP. The codec is designed for narrow band speech and results in a payload bit rate of 13.33 kbit/s with an encoding frame length of 30 ms and 15.20 kbps with an encoding length of 20 ms. The iLBC codec enables graceful speech quality degradation in the case of lost frames, which occurs in connection with lost or delayed IP packets.Features Bitrate 13.33 kbps (399 bits, packetized in 50 bytes) for the frame size of 30 ms and 15.2 kbps (303 bits, packetized in 38 bytes) for the frame size of 20 ms Basic quality higher than , high robustness to packet loss Computational complexity in a range of G.729A Royalty-free CodecNews
- iLBC no longer included with Asterisk source (1.4.19 and 1.6); to install ilbc codec translation:cd /usr/src/asterisk/./contrib/scripts/get_ilbc_source.shcp /usr/src/asterisk/contrib/scripts/codecs /usr/src/asterisk/codecs/./menuselect/menuselectselection 4 (codecs)to make sure ilbc selectedexit + savemakeasterisk -rvvvvvvvvvvvvload codec_ilbc.socore show translations
- Internet Engineering Task Force (IETF) has approved standardization of the iLBC codec.
- GIPS to Provide Major DSP Chip Manufacturer Infineon with iLBC Speech Codec to Accelerate Time-to-Market
- GIPS iLBC has been specified as a mandatory codec in the recently released
Links to this page...CodecsGIPSSRTPVOIP Phones ReviewsAsterisk codecsAsterisk codecs allowVOIP over SatellitePhonerLiteVOIP Phones
Please update this page with new information, just login and click on the
"Edit" or "Discussion" tab. Get a free login here:
Featured -
Powered by下次自动登录
现在的位置:
& 综合 & 正文
vc如何引入lib库
链接库分为静态链接库和动态链接库,静态链接库只有一个.lib文件,而动态链接库则有一个.lib文件和.dll文件;静态链接库的.lib文件里面有函数真正实现的机器码,而动态链接库的.lib只有函数的符号名,真正的函数的实现在dll文件中。
当你使用静态库或者使用隐式的方式加载动态连接库的话,都需要将.lib文件加到vc工程里面去,他们的区别就在于,使用动态库的话,在运行时,需要额外将函数真正实现的dll文件放到程序的运行目录下或者程序默认的搜索路径下,而静态库则只要引入.lib文件后,就可以调用库中的函数。
在vc环境下将lib库引入工程,有下面3种方法:
第一种方法,lib文件直接加入到工程文件列表中。
在VC中打开“File View”一页,选中工程名,单击鼠标右键,然后在弹出的快捷菜单中选择【Add Files to Project】命令,在弹出的文件对话框中选中要加入dll的lib文件即可。第二种方法,设置工程的【Project】菜单【Settings】来加载dll的lib文件
打开工程的【Project】菜单的【Settings】,选中【Link】,然后在“Object/library modules”下的文本框中输入dll的lib文件。
第三种方法,预编译指令导入
加入预编译指令#pragma comment(lib,”*.lib”),这种方法优点是可以利用条件预编译指令链接不同版本的lib文件。因为,在Debug方式下,产生的lib文件是Debug版本,如Regd.lib;在Release方式下,产生的lib文件时Release版本,如Regr.lib。
当然,在引入.lib文件后,工作并没有完成,为了解决编译问题,我们还需要将连接库中函数的对应的头文件(*.h)包含到其中,在这个头文件中给出了链接库中定义的函数原型。在编译完成后,连接器会去.lib文件中去查找函数的符号表,找到后,编译和连接工作就完成了;在运行的时候,再去dll文件中去找函数的真正实现(如果是静态库则直接在.lib文件中寻找函数的真正实现。)
ps:补充一句,关于加载动态链接库的两种方式隐式加载和显示加载,隐式加载就如上面所介绍的引入.lib文件,包含链接库的头文件,拷贝dll文件到运行目录下后就实现了隐式加载;而显示加载则是使用LoadLibrary和FreeLibrary来加载和卸载动态链接库,使用GetProcAddress函数来获取函数指针,然后通过函数指针来调用链接库中的函数。
&&&&推荐文章:
【上篇】【下篇】