如何安装一个c ++库,以便我可以使用它? [英] How do I install a c++ library so I can use it?

查看:223
本文介绍了如何安装一个c ++库,以便我可以使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 BASS 的图书馆,这是一个音频库,我将使用它来记录麦克风。我有所有需要使用它的文件,但我不知道如何安装库。我试着拿这些示例文件,并将它们放在与bass.h文件相同的目录。但我有一堆错误,说有不存在的函数调用。

I have this library called BASS which is an audio library which I'm going to use to record with the microphone. I have all the files needed to use it, but I don't know how to install the library. I tried taking the example files and putting them in the same directory as the bass.h file. But I got a bunch of errors saying there are function calls that doesn't exist.

所以我的问题是,如何安装它,以便能够使用它?

So my question is, how do I install it to be able to use it?

推荐答案

安装C ++库意味着为感兴趣的软件(例如编译器)指定两种文件的位置:典型的扩展名* .h或 .hpp)和编译对象( .dll或* .lib)。

Installing a C++ library means specifying to interested software (eg. a compiler) the location of two kinds of files: headers (typical extensions *.h or .hpp) and compiled objects (.dll or *.lib for instance).

你的程序会将它们包含在源代码中,dll将包含将被链接到或链接在一起并由你的程序使用的编译代码,并且它们将被链接器找到或动态加载,但这是另一个步骤)。

The headers will contain the declarations exposed to the developer by the library authors, and your program will #include them in its source code, the dll will contain the compiled code which will be or linked together and used by your program, and they will be found by the linker (or loaded dynamically, but this is another step).

因此您需要

1) put the header files in a location which your compiler is aware of (typically IDE allows to set so-called include directories, otherwise you specify a flag like "-I<path-to-headers>" when invoking the compiler)
2) put the dll files in a location which your linker is aware of (surely your IDE will allow that, otherwise you speficy a flag like "-L<path-to-libraries> -l<name-of-libraries>"

最后但并非最不重要的,是商业产品,他们可能会提供一些安装说明?

Last but not least, since I see that BASS library is a commercial product, probably they will have made available some installation instructions?

这篇关于如何安装一个c ++库,以便我可以使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆