objective c - Trying to use Swift with Obj C header for Coda2 plugin. Getting error: Undefined symbols for architecture x86_64 -
trying build plugin coda 2.5 swift.i'm getting error:
undefined symbols architecture x86_64: "_objc_class_$_codapluginscontroller", referenced from: _get_field_types_powpluginviewcontroller in powpluginviewcontroller.o _get_field_types_powplugin in powplugin.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)
i have cleaned build folder. have created , added import statements project name-bridging-swift.h.
here @ project.
codapluginscontroller.h
you can find file here. https://github.com/panicinc/codapluginkit/tree/master/cocoa%20plug-ins discription: this header provides protocols , facilities implement coda text-based, syntax validator , sidebar plug-in.
codapow-bridging-header.h
// // use file import target's public headers expose swift. // #import "codapluginscontroller.h"
powplugin.swift
import foundation class powplugin: nsobject, codaplugin, codasidebarplugin { let powbundle: codapluginbundle let powcontroller: codapluginscontroller required init(plugincontroller: codapluginscontroller, pluginbundle: codapluginbundle) { self.powbundle = pluginbundle self.powcontroller = plugincontroller super.init() } func name() -> string { return "coda pow" } func didloadsitenamed(name: string!) { } func viewcontroller() -> nsviewcontroller { return powpluginviewcontroller(nibname: "powpluginview", pluginbundle: powbundle, plugincontroller: powcontroller)! } }
powpluginviewcontroller.swift
import foundation class powpluginviewcontroller: nsviewcontroller, codasidebarviewcontroller { let powcontroller: codapluginscontroller init?(nibname: string, pluginbundle: anyobject, plugincontroller: codapluginscontroller) { self.powcontroller = plugincontroller super.init(nibname: nibname, bundle: pluginbundle as? nsbundle) } // xcode says need this. required init?(coder: nscoder) { fatalerror("init(coder:) has not been implemented") } }
i have 2 more source files. serverandhosts.swift , shell.swift don't use of classes in codapluginscontroller.h. shell.swift file set of class functions.
edit: can use swift long don't subclass codapluginscontroller.h or pass in object has been.
swift , obj-c versions of project: https://www.dropbox.com/sh/bsw8cinn7kp9kfe/aaagg_b44dbhnp5-jwj3amf8a?dl=0
the project compiles, bridging headers may not issue.
you fail @ linking stage, compiler can't find set of symbols current architecture. either mean
1) coda library not compiled architecture
or
2) linker couldn't find library @ all.
i looked @ obj-c project, , appears coda library not in project, i'm guessing #2. you'll either want move lib project somehow, or add path lib elsewhere on system in project's "library search paths"
Comments
Post a Comment