undefined reference to error

I downloaded a library called Aquila. They provided examples of how to use the library, but whenever I run them I keep getting errors "undefined reference to..."

Here is an example that was provided

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  #include "/home/robert/Dev/aquila/aquila-src/aquila/source"
#include <iostream>

int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        std::cout << "Usage: wave_info <FILENAME>" << std::endl;
        return 1;
    }
    Aquila::WaveFile wav(argv[1]);
    std::cout << "Filename: "           << wav.getFilename();
    std::cout << "\nLength: "           << wav.getAudioLength()     << " ms";
    std::cout << "\nSample frequency: " << wav.getSampleFrequency() << " Hz";
    std::cout << "\nChannels: "         << wav.getChannelsNum();
    std::cout << "\nByte rate: "        << wav.getBytesPerSec()/1024 << " kB/s";
    std::cout << "\nBits per sample: "  << wav.getBitsPerSample() << "b\n";

    return 0;
}



The errors are:
wave_info.cpp:(.text+0xa7): undefined reference to `Aquila::WaveFile::WaveFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Aquila::StereoChannel)'
wave_info.cpp:(.text+0x120): undefined reference to `Aquila::WaveFile::getAudioLength() const'
wave_info.cpp:(.text+0x23c): undefined reference to `Aquila::WaveFile::~WaveFile()'
wave_info.cpp:(.text+0x2a6): undefined reference to `Aquila::WaveFile::~WaveFile()'
collect2: error: ld returned 1 exit status


Since I downloaded everything from online, do I need to still compile all the provided files before running this? That could be the issue but I'm not sure.

I think you would need to build the library first.
How to build from source: http://aquila-dsp.org/download/

Once the library is built, the program should be linked with it and the directory where it was installed should be specified as a directory to search for libraries.
See: -l https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Link-Options.html#Link-Options
and -L https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Directory-Options.html#Directory-Options
Topic archived. No new replies allowed.