Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install a c++ library so I can use it?

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?

like image 692
rzetterberg Avatar asked Jul 01 '09 14:07

rzetterberg


People also ask

Where do I put C libraries in Windows?

Typically if a library needs to be installed for shared use it will do one of two things: Install to it's own location under Program Files or Program Files\Common Files. Install to \Windows\System32 or (very rarely) \Windows.

Where can I find C library?

Libaries consist of a set of related functions to perform a common task; for example, the standard C library, 'libc. a', is automatically linked into your programs by the “gcc” compiler and can be found at /usr/lib/libc. a. Standard system libraries are usually found in /lib and /usr/lib/ directories.

How do C libraries work?

C libraries store files in object code; during the linking phase of the compilation process ( Compilation Process) files in object code are accessed and used. It is faster to link a function from a C library than to link object files from a separate memory sticks or discs.


1 Answers

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).

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).

So you need to

  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?

like image 173
Francesco Avatar answered Oct 05 '22 23:10

Francesco