【问题标题】:using sox files in Qt在 Qt 中使用 sox 文件
【发布时间】:2021-07-05 08:57:05
【问题描述】:

我想用 QT 制作用于音频的 c++ 应用程序,我想使用 sox,我导入了 sox.sourceforg.net 项目代码的 src 文件夹。并输入非常简单的代码

#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <src/sox.h>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    sox_format_t* input = sox_open_read("d.wav", NULL, NULL, NULL);
}

MainWindow::~MainWindow()
{
    delete ui;
}

但遇到undefined reference to sox_open_read' 的错误。因为这个功能在我编程时会自动完成显示。

我在这个网站和 github 上搜索了很多,找到了这些下面的链接,但没有修复我的 prb

Recording using sox in c/c++

Android NDK linking problems

How can I send my audio file to stdout with the libsox library?

Reducing a channel from wav file using libsox

How can i determine duration of wav file

【问题讨论】:

    标签: c++ c qt sox


    【解决方案1】:

    我建议您添加错误消息。如果错误与链接器(LNK...)有关,那么您没有将 sox 库链接到应用程序中。

    【讨论】:

    • C:\Users\SATSom\Documents\Qt Project 1\build-resample-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\..\resample\mainwindow.cpp:12:错误:未定义对sox_open_read' debug/mainwindow.o: In function MainWindow 的引用: :MainWindow(QWidget*)': C:\Users\SATSom\Documents\Qt Project 1\build-resample-Desktop_Qt_5_15_2_MinGW_64_bit-Debug/../resample/mainwindow.cpp:12: undefined reference to `sox_open_read'
    • 好吧有点奇怪。尝试用 extern-c 包装 src/sox.h:使用(以行分隔)extern "C" { #include &lt;src/sox.h&gt; }
    • 谢谢,但是这个prb仍然有同样的错误;(
    • 那么你真的链接到图书馆了吗?您是否将它添加到您的配置文件中(当您使用 qmake 时)?
    • 这些绝对是任何prjs的第一部作品
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-30
    • 2012-09-15
    • 1970-01-01
    • 2011-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多