Calling exiftool from Cocoa

Started by DesertNomad, October 02, 2018, 07:46:50 PM

Previous topic - Next topic

DesertNomad

#include <iostream>
#include "ExifTool.h"   //  this is a .mm file so that we can include C++ code/structures

@implementation MyClass

-(id)myInit
{
    if (self = [super init])
    {
        ExifTool* tool = new ExifTool("/Users/myusername/Tools/exiftool");
        delete tool;
    }
}
This is obviously just a test but in the "new ExifTool" line I get a crash:

dyld`dyld_fatal_error:
    0x7fff5fc01074 <+0>: int3   
->  0x7fff5fc01075 <+1>: nop   

Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)

dyld: Symbol not found: __ZN8ExifToolC1EPKcS1_

Phil Harvey

I assume you included the C++ source code files in your project?

Try a dummy C++ class to see if that works.  If it does, you could iteratively add variables/methods to it until you get the full ExifTool object -- this should let you figure out what specifically was the problem, although it may take a few iterations.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

DesertNomad

#2
t turns out that the C++ code files associated with this were getting copied into the app rather than compiled. It works as expected. With just the header files there was no error, and a pretty cryptic crash.

Thank you.