qt 运行 提示 无法解析的外部符号

展开阅读全文

QT中导入第三方库并使用,编译时给出LNK2019:无法解析的外部命令。

11-14

QT项目中导入libzplay这个第三方库用于音频处理,但是导入后使用时发生错误,显示 ``` mainwindow.obj:-1: error: LNK2019: 无法解析的外部符号 __imp_CreateZPlay,该符号在函数 "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z) 中被引用 ``` 尝试过重构项目并且重新QMake但是始终会产生这个问题,真的是无力了,希望有大佬能够帮下忙 下面是项目文件和我使用时的代码: ``` QT += core gui widgets TARGET = test_import_dll TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target unix:!macx|win32: LIBS += -L$$PWD/../../DB_project/libzplay-2.02-sdk/C++/ -llibzplay INCLUDEPATH += $$PWD/../../DB_project/libzplay-2.02-sdk/C++ DEPENDPATH += $$PWD/../../DB_project/libzplay-2.02-sdk/C++ win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../DB_project/libzplay-2.02-sdk/C++/libzplay.lib else:unix:!macx|win32-g++: PRE_TARGETDEPS += $$PWD/../../DB_project/libzplay-2.02-sdk/C++/libzplay.a ``` 建了个mainwindow想在里面测试下结果使用不了: ``` #include "mainwindow.h" #include "ui_mainwindow.h" #include<libzplay.h> using namespace libZPlay; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ZPlay* p= CreateZPlay(); ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } ``` 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览