Как использовать библиотеку MediaInfoLib в C++

Пытаюсь получить информацию об аудиофайле с помощью MediaInfo.h

mainwindow.cpp

#include <MediaInfo/MediaInfo.h>
#define MediaInfoNameSpace MediaInfoLib;
#define _itot itoa
#include <string>

using namespace MediaInfoNameSpace;
.
.
.
void MainWindow::on_pushButton_1_clicked()
{
   MediaInfoLib::MediaInfo MI;   
   MI.Open(file_str);   
   auto codec=MI.Get(stream_t::Stream_Audio, 0, "Format");
   std::cout << "Codec :" << codec << std::endl;   
   MI.Close();

}
.
.
.

На этот раз при компиляции вылетает ошибка: error: undefined reference to `MediaInfoLib::MediaInfo::MediaInfo()’


Ответы (1 шт):

Автор решения: Majestio

Подскажите, что я делаю не так?

Внимательно прочтите описание методов Open и тогда появится ответ:

        ...

        /// Open a file and collect information about it (technical information and tags)
        /// @brief Open a file
        /// @param File_Name Full name of file to open
        /// @retval 0 File not opened
        /// @retval 1 File opened
    size_t Open (const String &File_Name);

        /// Open a Buffer (Begin and end of the stream) and collect information about it (technical information and tags)
        /// @brief Open a buffer
        /// @param Begin First bytes of the buffer
        /// @param Begin_Size Size of Begin
        /// @param End Last bytes of the buffer
        /// @param End_Size Size of End
        /// @param File_Size Total size of the file
        /// @retval 0 File not opened
        /// @retval 1 File opened
    size_t Open (const ZenLib::int8u* Begin, size_t Begin_Size, const ZenLib::int8u* End=NULL, size_t End_Size=0, ZenLib::int64u File_Size=0);

        ...

!! Оказывается правильный вопрос - "как собрать и подключить библиотеку MediaInfoLib", значит мой ответ не об этом.

→ Ссылка