我正在嘗試使用Taglib
和Qt5.7
。但我的程序崩潰:使用Taglib編程崩潰
The GDB process terminated unexpectedly (exit code 0).
Cannot continue debugged process: The program is not being run.
During startup program exited with code 0xc0000135
建設Taglib時似乎沒有任何錯誤信息。
* .pro文件
QT += core
QT -= gui
CONFIG += c++11
TARGET = untitled2
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
TAGLIBDIR = $$quote(D:/D/Programmieren/Libraries/taglib)
INCLUDEPATH += $$quote($${TAGLIBDIR}/include)
LIBS += -L$$quote($${TAGLIBDIR}/lib) -ltag
的main.cpp
#include <QCoreApplication>
#include <taglib/tag.h>
#include <taglib/fileref.h>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
TagLib::FileRef ref("D:/D/Media/Musik/Disturbed/The Sickness/Disturbed - Stupify.mp3");
return a.exec();
}
編輯: 我使用的CMake-GUI和本地的MinGW-安裝,因爲我沒能創造他們創建標籤庫,構建文件使用Qt。我的操作系統是Windows 10 x64教育版,我使用Qt-Creator。我下載了最新的Taglib-Release(1.11.1)
爲什麼我不能使用CMake創建構建文件: 首先一些* dll文件丟失了,我只是通過將本地MinGW-Installation複製到QT來解決這個問題-MinGW。 第二我找不到任何CMake所需的* exe文件,所以我無法從本機MinGW-Installation中更改路徑。
在debugmode重建的Taglib後,我得到這個錯誤:
main.cpp:10: error: undefined reference to `_imp___ZN6TagLib8FileNameC1EPKc'
main.cpp:10: error: undefined reference to `_imp___ZN6TagLib7FileRefC1ENS_8FileNameEbNS_15AudioProperties9ReadStyleE'
main.cpp:11: error: undefined reference to `_imp___ZNK6TagLib7FileRef3tagEv'
main.cpp:11: error: undefined reference to `_imp___ZNK6TagLib6String9toCStringEb'
main.cpp:11: error: undefined reference to `_imp___ZN6TagLib6StringD1Ev'
main.cpp:10: error: undefined reference to `_imp___ZN6TagLib7FileRefD1Ev'
main.cpp:11: error: undefined reference to `_imp___ZN6TagLib6StringD1Ev'
main.cpp:10: error: undefined reference to `_imp___ZN6TagLib7FileRefD1Ev'
collect2.exe:-1: error: error: ld returned 1 exit status
如果你在GDB中鍵入'bt',你會得到一個回溯,這對於試圖找出問題來自哪裏將非常有用。 – scotchi
@scotchi我必須在哪裏添加'bt'?我會猜測在'運行設置'中的'命令行參數'?我看不出與輸出有什麼不同。此外,我不知道這是如何可以幫助,因爲在啓動過程中崩潰。 – honiahaka10
你粘貼的輸出表明你正在使用GDB(GNU Debugger)。 GDB有一個控制檯,您可以在其中輸入命令 - 輸入'bt'打印回溯。這不是您的程序的命令 - 它是GDB的命令。 – scotchi