将SFML链接到Windows上的QT
Linking SFML into QT on Windows
我应该做一个音频分析程序。我已经成功安装了QT Creator,并且我还设法包含SFML库。
这是我添加到 audioPlayer.pro 文件中的内容:
INCLUDEPATH += D:\qt\SFML-2.2\include\SFML
INCLUDEPATH += D:\qt\SFML-2.2\include
LIBS += D:\qt\SFML-2.2\bin\sfml-audio-d-2.dll
主寡妇.cpp:
void 主窗口::on_pushButton_clicked(){ QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "C://", tr("Audio files (*.wav)"));
std::string file = fileName.toStdString();
sf::SoundBuffer buffer;
buffer.loadFromFile((file));
sf::Sound sound;
sound.setBuffer(buffer);
sound.play();
}
我相信这里发生的事情很明显。
因此,当我构建项目时,我收到 8 个错误:
mainwindow.obj:-1: error: LNK2019: 未解析的外部符号 "__declspec(dllimport) public: __thiscall sf::Sound::Sound(void)" (__imp_??0Sound@sf@@QAE@XZ) 在函数"private: void __thiscall MainWindow::on_pushButton_clicked(void)" (?on_pushButton_clicked@MainWindow@@AAEXXZ) 中引用
其他的都是一样的,所以我没有粘贴它们。
这是最后一个:
调试\音频播放器.exe:-1:错误:LNK1120:7 个未解析的外部
所以是的。我尝试手动将编译器包含在工具>选项>构建和运行中。我设置了 MinGw 编译器。我已经遵循了这个网站和其他网站上的几个教程,但我就是想不通。
我查看了这两个链接:
https://github.com/LaurentGomila/SFML/wiki/Tutorial:-Compile-and-Link-SFML-with-Qt-Creatorhttps://github.com/LaurentGomila/SFML/wiki/Tutorial:-Link-SFML-with-Qt-Creator
但没有成功。
我通过切换到 Linux Ubuntu 解决了这个问题,我使用上面的这个链接成功地共同构建了它:https://github.com/LaurentGomila/SFML/wiki/Tutorial:-Compile-and-Link-SFML-with-Qt-Creator
- 清理"QSettings"注册表项的最佳方法(Windows上的Qt 5)
- Mac Snow Leopard 上的 Qt 5.3.2:ld:在架构x86_64 [clang、Objective-C
- 集合布局上的 Qt 分割错误
- 项目引用上的QT访问冲突
- 如何在macOS上的Qt中使用OpenMP进行编译?
- 如何在Mac OSX上的Qt中使用pkcs12 / pfx成功执行SSL加密?
- 按钮组上的 Qt 信号未连接
- 打开终端时出错:MacOs 10.12.4 上的 Qt Creator 未知
- Mac上的QT:形式布局无法水平伸展
- macOS 上的 Qt Creator 出现问题 - ld:找不到 -lQt5Widgets_debug 的库
- 我如何将OpenSSL包含在Linux上的Qt程序中
- Android 和 IOS 上的 Qt 会话管理
- 在 macOS 10.13.6 clang 7.0 上的 Qt 5.12.0 上找不到'QtSerialPort'文件
- dynamic_cast over共享库在使用clang编译的Android上的Qt中失败
- RaspberryPi上的QT -QXMLATTRIBUTS隐式声明
- 如何使用PCL库在Ubunto上的Qt中查看3D PCD
- Ubuntu 上的 Qt+OpenCV 无法运行/调试:无法启动应用程序
- 如何在OS X上的Qt应用程序中设置应用程序图标,足以进行分发
- 服务器客户端程序上的QT-QFileSystemModel
- 安卓系统上的Qt蓝牙.通过抽象类上的jni调用java类