我目前正在尝试从 C# 迁移并通过使用 Qt / C++ 摆脱我的平台边界。
我在旧项目中使用了 TagLibSharp,但我现在尝试使用此处找到的原始 C++ 源代码:
http://developer.kde.org/~wheeler/taglib.html
试图将其编译到我的应用程序中,我陷入了痛苦的世界。大多数基于 Linux 的 C++ 对我来说都是胡言乱语,我不知道如何正确地将这个库包含到我的 Qt 项目中。我的大部分工作都在使用 Qt Creator(尽我所能)。
谁能指点我一些有用的教程或指南?任何能帮助我理解我什至用这个来源做什么的东西都将不胜感激。我对 C# 和 Windows 编程有非常透彻的了解,但我并不能很好地掌握我正在使用这些类型的开源项目做什么。
谢谢!
编辑 - 答案在这里 我决定发布另一个更精致的问题。
一些较旧的编辑...
我现在用 Qt 编译了 TagLib,但遇到了“未定义的引用”错误。
*.pro
INCLUDEPATH += ../$${TARGET}/taglib-win32
LIBS += -L"..\\$${TARGET}\\taglib-win32"
LIBS += -llibtag #It seems to want this to be a *.dll, not a *.a?
DEFINES += TAGLIB_NO_CONFIG
*.cpp
#include <tag.h>
#include <fileref.h>
...
//None of these work, even though they are similar to examples given in TagLib source.
TagLib::FileRef f("03.flac");
TagLib::String test = f.tag()->album();
TagLib::FileName *n = new TagLib::FileName("test");
TagLib::FileRef *f = new TagLib::FileRef();
以下是一些确切错误的示例:
./debug\mythread.o:C:\Users\jocull\Documents\My Dropbox\Code\QT\QtTrayTime-build-desktop/../QtTrayTime/mythread.cpp:20: undefined reference to `_imp___ZN6TagLib7FileRefC1ENS_8FileNameEbNS_15AudioProperties9ReadStyleE'
./debug\mythread.o:C:\Users\jocull\Documents\My Dropbox\Code\QT\QtTrayTime-build-desktop/../QtTrayTime/mythread.cpp:21: undefined reference to `_imp___ZNK6TagLib7FileRef3tagEv'
./debug\mythread.o:C:\Users\jocull\Documents\My Dropbox\Code\QT\QtTrayTime-build-desktop/../QtTrayTime/mythread.cpp:42: undefined reference to `_imp___ZN6TagLib6StringD1Ev'
./debug\mythread.o:C:\Users\jocull\Documents\My Dropbox\Code\QT\QtTrayTime-build-desktop/../QtTrayTime/mythread.cpp:42: undefined reference to `_imp___ZN6TagLib7FileRefD1Ev'
collect2: ld returned 1 exit status
使用 g++ (Mac/Linux) 的命令行步骤
- ./configure --enable-shared=false --enable-static=true
- 制作
- ???未创建 *.a 或 *.lib 文件