我正在尝试编写一个简单的 Qt Widget 应用程序,它允许我使用 Qt 框架 && Adobe XMP SDK读写 .XMP 文件strong> 在 OS X 10.10 上。
我是菜鸟,绝不是 C++ 专业人士 (并且具有 C++ 和 Qt 的基本/中级自学知识,这意味着我在尝试时依赖于 google做某事,有时最终会使用可以简化的坏习惯或代码)
- 我已经从 Adobe 下载并构建了 XMP SDK,并构建了部分示例
(由于某种原因我无法构建其他的,但现在这不是那么重要)。
我已经构建了库的静态 64 位版本(libXMPCoreStatic.a && libXMPFilesStatic.h)
连同公用文件夹中的 include 文件夹,我将它们放在了我的 Qt Widget App 项目 的文件夹中的子文件夹 Framework
我已将这些库链接到我的项目(在我的 .pro 文件中):
LIBS += -L$$PWD/XMPFramework/ -lXMPCoreStatic LIBS += -lXMPFilesStatic INCLUDEPATH += $$PWD/XMPFramework/include/ DEPENDPATH += $$PWD/XMPFramework/ PRE_TARGETDEPS += $$PWD/XMPFramework/libXMPCoreStatic.a PRE_TARGETDEPS += $$PWD/XMPFramework/libXMPFilesStatic.a
我已将 XMP 包含在我的应用程序中(基本应用程序仅用于测试我是否可以连接和使用 XMP SDK 的一些基础知识)- mainwindow.cpp:
#include "mainwindow.h" #include "ui_mainwindow.h" #include <cstdio> #include <string> #include <cstring> #define MAC_ENV 1 //don't know why, but when I don't explicitly //define this, then the app won't build // Must be defined to instantiate template classes //#define TXMP_STRING_TYPE std::string //when used, I get whole range of errors, there's a sample at the end of the question // Must be defined to give access to XMPFiles #define XMP_INCLUDE_XMPFILES 1 #include <XMP.incl_cpp> //XMP INCLUDE #include <XMP.hpp> //XMP INCLUDE MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //this if is taken from the sample code //for the SDK, the problem is that //my project does not know the SXMPMeta //but seems to know at least part of the SDK //because at least part of the classes and methods //are visible through the intellisense if(!SXMPMeta::Initialize()) { //the project does not react to SXMPMeta //and does not know it, even though the //XCode project I've built from the SDK's samples //seems to be ok ... } } ...the rest omitted for brevity...
您是否看到我犯的一些错误或 SXMPMeta 类不存在的原因?
我尝试使用 #define TXMP_STRING_TYPE std::string
时遇到的错误示例.我的想法是它与模板化 XMP 类的初始化有关
Undefined symbols for architecture x86_64:
"_CFBundleCopyExecutableArchitectures", referenced from:
XMP_PLUGIN::IsValidLibrary(std::string const&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFBundleCopyResourceURL", referenced from:
XMP_PLUGIN::GetResourceDataFromModule(__CFBundle*, std::string const&, std::string const&, std::string&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFBundleCreate", referenced from:
XMP_PLUGIN::IsValidLibrary(std::string const&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
XMP_PLUGIN::LoadModule(std::string const&, bool) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFBundleGetFunctionPointerForName", referenced from:
XMP_PLUGIN::GetFunctionPointerFromModuleImpl(__CFBundle*, char const*) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFBundleIsExecutableLoaded", referenced from:
XMP_PLUGIN::LoadModule(std::string const&, bool) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFBundleLoadExecutableAndReturnError", referenced from:
XMP_PLUGIN::LoadModule(std::string const&, bool) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFDataGetBytes", referenced from:
XMP_PLUGIN::GetResourceDataFromModule(__CFBundle*, std::string const&, std::string const&, std::string&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFNumberGetValue", referenced from:
XMP_PLUGIN::GetResourceDataFromModule(__CFBundle*, std::string const&, std::string const&, std::string&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFRelease", referenced from:
XMP_PLUGIN::IsValidLibrary(std::string const&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
XMP_PLUGIN::LoadModule(std::string const&, bool) in libXMPFilesStatic.a(OS_Utils_Mac.o)
XMP_PLUGIN::UnloadModule(__CFBundle*, bool) in libXMPFilesStatic.a(OS_Utils_Mac.o)
XMP_PLUGIN::GetFunctionPointerFromModuleImpl(__CFBundle*, char const*) in libXMPFilesStatic.a(OS_Utils_Mac.o)
XMP_PLUGIN::GetResourceDataFromModule(__CFBundle*, std::string const&, std::string const&, std::string&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFStringCreateWithCString", referenced from:
XMP_PLUGIN::GetFunctionPointerFromModuleImpl(__CFBundle*, char const*) in libXMPFilesStatic.a(OS_Utils_Mac.o)
XMP_PLUGIN::GetResourceDataFromModule(__CFBundle*, std::string const&, std::string const&, std::string&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFURLCreateDataAndPropertiesFromResource", referenced from:
XMP_PLUGIN::GetResourceDataFromModule(__CFBundle*, std::string const&, std::string const&, std::string&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
"_CFURLCreateFromFileSystemRepresentation", referenced from:
XMP_PLUGIN::IsValidLibrary(std::string const&) in libXMPFilesStatic.a(OS_Utils_Mac.o)
When executing step 'Make'
最佳答案
TXMPFiles
是一个模板。 SXMPFiles
是TXMPFiles<std::string>
.以下代码出现在 XMP Toolkit 2016.07 示例之一的开头:
// Must be defined to instantiate template classes
#define TXMP_STRING_TYPE std::string
// Must be defined to give access to XMPFiles
#define XMP_INCLUDE_XMPFILES 1
// Ensure XMP templates are instantiated
#include "public/include/XMP.incl_cpp"
// Provide access to the API
#include "public/include/XMP.hpp"
关于c++ - 在 Adobe XMP SDK 中找不到 SXMPMeta,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29627760/