TagLib 라이브러리를 사용하는 프로젝트를 만들려고합니다. 나는 그것에 대해 정확히 어떻게 갈 지 잘 모르겠다.Qt 프로젝트에 라이브러리를 포함하는 방법
TagLib 1.11.1을 다운로드했습니다.
빌드 ZLIB를 먼저 다음 Visual Studio에서이 솔루션을 구축, CMake는 비주얼 스튜디오 솔루션 파일을 생성함으로써 : MKDIR은 & &를 구축
을 다음과 같이
나는 그것을 구축 cd 빌드 cmake .. -G "Visual Studio 14 2015 Win64"-DCMAKE_INSTALL_PREFIX = "e : \ workspace \ lib \ installed" msbuild/P : 구성 = 디버그 INSTALL.vcxproj msbuild를/P : 구성 = 릴리스 INSTALL.vcxproj
거의 같은 방법으로 태그 라이브러리를 구축 :
CD .... \ 태그 라이브러리-1.11.1 는 MKDIR은 & & CD를 구축 빌드 cmake .. -G "Visual Studio 14 2015 Win64"-DCMAKE_INSTALL_PREFIX = "e : \ workspace \ lib \ installed"-DZLIB_INCLUDE_DIR = "e : \ 작업 공간 \ lib \ 설치된 \ 포함"-DZLIB_LIBRARY = "e : \ 작업 영역 \ lib \ installed \ lib \ zlib.lib "-DWITH_ASF = on -DWITH_MP4 = on -DBUILD_EXAMPLES = on msbuild/P : Configuration = Rele ASE INSTALL.vcxproj
내가 만드는 간단한 Qt는 콘솔 응용 프로그램 :
그때 Qt는
Qt를 사용
E:\workspace\lib\installed\lib
에서 빌드 위의 태그 라이브러리에서tag.lib
를 추가 - > 라이브러리 추가 -> 라이브러리 유형 (외부 라이브러리) -> .......
MAIN.CPP :
#include <QCoreApplication>
#include <QDebug>
#include <taglib/fileref.h>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
TagLib::FileRef f("D:/Dire Straits - Sultans of Swing.mp3");
return a.exec();
}
taglibtest.pro
QT += core
QT -= gui
CONFIG += c++11
TARGET = taglibtest
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/taglib/builds/ -ltag
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/taglib/builds/ -ltagd
else:unix: LIBS += -L$$PWD/taglib/builds/ -ltag
INCLUDEPATH += $$PWD/taglib/builds
DEPENDPATH += $$PWD/taglib/builds
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/taglib/builds/ -ltag
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/taglib/builds/ -ltagd
else:unix: LIBS += -L$$PWD/taglib/builds/ -ltag
INCLUDEPATH += $$PWD/taglib/builds
DEPENDPATH += $$PWD/taglib/builds
HEADERS += \
taglib/aifffile.h \
taglib/aiffproperties.h \
taglib/apefile.h \
taglib/apefooter.h \
taglib/apeitem.h \
taglib/apeproperties.h \
taglib/apetag.h \
taglib/asfattribute.h \
taglib/asffile.h \
taglib/asfpicture.h \
taglib/asfproperties.h \
etc....
etc....
내가 Qt를에서 프로젝트 구축하려고 할 때마다 나는 다음과 같은 오류를 얻을 :
F:\taglibtest\main.cpp:-1: error: undefined reference to `_imp___ZN6TagLib8FileNameC1EPKc'
F:\taglibtest\main.cpp:-1: error: undefined reference to `_imp___ZN6TagLib7FileRefC1ENS_8FileNameEbNS_15AudioProperties9ReadStyleE'
F:\taglibtest\main.cpp:-1: error: undefined reference to `_imp___ZN6TagLib7FileRefD1Ev'
F:\taglibtest\main.cpp:-1: error: undefined reference to `_imp___ZN6TagLib7FileRefD1Ev'
:-1: error: release/main.o: bad reloc address 0x0 in section `.ctors'
:-1: error: final link failed: Invalid operation
collect2.exe:-1: error: error: ld returned 1 exit status
무엇을해야 이 문제를 해결하고 TagLib로 작업하게합니까?
QT += core
QT -= gui
CONFIG += c++11
TARGET = taglibtest
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/taglib/builds/ -ltag
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/taglib/builds/ -ltagd
else:unix: LIBS += -L$$PWD/taglib/builds/ -ltag
INCLUDEPATH += $$PWD/taglib/builds
DEPENDPATH += $$PWD/taglib/builds
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/taglib/builds/ -ltag
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/taglib/builds/ -ltagd
else:unix: LIBS += -L$$PWD/taglib/builds/ -ltag
INCLUDEPATH += $$PWD/taglib/builds
DEPENDPATH += $$PWD/taglib/builds
HEADERS += \
taglib/aifffile.h \
taglib/aiffproperties.h \
taglib/apefile.h \
taglib/apefooter.h \
taglib/apeitem.h \
taglib/apeproperties.h \
taglib/apetag.h \
taglib/asfattribute.h \
taglib/asffile.h \
taglib/asfpicture.h \
taglib/asfproperties.h \
etc....
etc....