2

I'm trying to write a simple Qt Widget Application that allows me to read and write .XMP files using Qt framework && Adobe XMP SDK on OS X 10.10.

I'm a rookie and by no means proffesional in C++ (and have basic/intermediate self-taught knowledge of C++ and Qt, which means I'm dependent on google when trying to do something and sometimes end up using bad habits or code that can be simplified)

  1. I have downloaded and built the XMP SDK from Adobe and built part of the examples

(for some reason or another I have not been able to build the other ones, but that's not that important right now).

  1. I have built the static 64bit version of the libraries (libXMPCoreStatic.a && libXMPFilesStatic.h)

  2. Together with the include folder from the public folder I've placed them in my Qt Widget App project's folder into subfolder Framework

  3. I have linked the libraries to my project (in my .pro file):

    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
    
  4. I have included the XMP in my app (basic app just for testing if I can connect and use some basics of 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...
    

    Do you see some mistakes i've made or the reason the SXMPMeta class is not present?


Sample of the errors I get when I try to use #define TXMP_STRING_TYPE std::string. My thought is that it has something to do with the initialization of the templated XMP classes

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'
mishan
  • 1,177
  • 3
  • 19
  • 42

1 Answers1

0

TXMPFiles is a template. SXMPFiles is TXMPFiles<std::string>. Following code is present in the beginning of one of XMP Toolkit 2016.07 examples:

// 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"
Euri Pinhollow
  • 332
  • 2
  • 17