首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >来自Cocoa的exiftool

来自Cocoa的exiftool
EN

Stack Overflow用户
提问于 2018-10-03 07:44:17
回答 1查看 93关注 0票数 0

我正在尝试使用exiftool form Cocoa

代码语言:javascript
复制
#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/trygve/Tools/exiftool");
    }
 }

这显然只是一个测试,但在“新的ExifTool”行中,我遇到了崩溃:

代码语言:javascript
复制
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_

下面的代码在一个直接的C++终端程序中运行良好。这来自exiftool开发人员页面上的示例。为什么这段代码可以很好地工作,但当我尝试从Cocoa .mm文件中使用它时,它却不行?

代码语言:javascript
复制
#include <iostream>
#include "ExifTool.h"

int main(int argc, char **argv)
{
    if (argc < 2) {
        std::cout << "Example1: Read metadata from an image." << std::endl;
        std::cout << "Please specify input file name" << std::endl;
        return 1;
    }
    // create our ExifTool object
    ExifTool *et = new ExifTool("/Users/trygve/Tools/exiftool");
    // read metadata from the image
    TagInfo *info = et->ImageInfo(argv[1],NULL,5);
    if (info) {
        // print returned information
        for (TagInfo *i=info; i; i=i->next) {
            std::cout << i->name << " = " << i->value << std::endl;
        }
        // we are responsible for deleting the information when done
        delete info;
    } else if (et->LastComplete() <= 0) {
        std::cerr << "Error executing exiftool!" << std::endl;
    }
    // print exiftool stderr messages
    char *err = et->GetError();
    if (err) std::cerr << err;
    delete et;      // delete our ExifTool object
    return 0;
}
EN

回答 1

Stack Overflow用户

发布于 2018-10-03 18:45:09

事实证明,与此相关的C++代码文件被复制到应用程序中,而不是编译。它的工作方式与预期一致。只有头文件,没有错误,并且发生了相当隐秘的崩溃。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52617857

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档