jeudi 1 juin 2017

undefined reference to Aquila::WaveFile

I am trying to compile a program using Aquila dsp library. The code is:

#include "/usr/aquila/include/aquila/source/WaveFile.h"
#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 make file is:

MFCC: main.o 
    g++-5 -Wall -std=c++11 -L/usr/aquila/lib -lOoura_fft -lAquila main.o -o MFCC

main.o: main.cpp
    g++-5 -c -Wall -std=c++11 main.cpp

clean:
    rm *.o MFCC

When I try to compile it, the following message is showed:

dario@dario-Lenovo-G460:~/Contenidos/HSTM/C++/MFCC$ make
g++-5 -Wall -std=c++11 -L/usr/aquila/lib -lOoura_fft -lAquila main.o -o MFCC
main.o: In function `main':
main.cpp:(.text+0xa4): undefined reference to `Aquila::WaveFile::WaveFile(std::string const&, Aquila::StereoChannel)'
main.cpp:(.text+0x117): undefined reference to `Aquila::WaveFile::getAudioLength() const'
main.cpp:(.text+0x224): undefined reference to `Aquila::WaveFile::~WaveFile()'
main.cpp:(.text+0x28b): undefined reference to `Aquila::WaveFile::~WaveFile()'
collect2: error: ld returned 1 exit status
make: *** [MFCC] Error 1

The nearest forum I found is at: Undefined reference with extern C

I tried to apply all the advices given there, but the error remains. My OS is:

dario@dario-Lenovo-G460:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty

Thanks!

Aucun commentaire:

Enregistrer un commentaire