2014-12-06 11 views
1

에 대한 정의되지 심볼 : 오류가Coda2 플러그인에 Obj C 헤더가있는 Swift를 사용하려고합니다. swift.I'm이 오류가와 코다 2.5 플러그인을 구축을 위해 노력 아키텍처 x86_64의

Undefined symbols for 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 for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

내 빌드 폴더를 청소했다. 프로젝트 이름 -bridging-swift.h에 가져 오기 문을 생성하고 추가했습니다.

다음은 내 프로젝트입니다.

CodaPlugInsController.h

현재이 파일을 찾을 수 있습니다. https://github.com/panicinc/CodaPluginKit/tree/master/Cocoa%20Plug-ins Discription : 이 헤더는 Coda 텍스트 기반 구문 유효성 검사기 및 사이드 바 플러그인을 구현하는 데 필요한 프로토콜과 기능을 제공합니다.

CodaPow 브리징-header.h가

// 
// Use this file to import your target's public headers that you would like to expose to 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 I need this. 
    required init?(coder: NSCoder) { 
     fatalError("init(coder:) has not been implemented") 
    } 
} 

두 개의 소스 파일이 더 있습니다. ServerAndHosts.swiftShell.swift는 그들은 CodaPlugInsController.h의 클래스 중 하나를 사용하지 마십시오. Shell.swift 파일은 클래스 함수 집합입니다.

편집 : 나는 CodaPlugInsController.h에서 서브 클래스 나 된 개체에 전달하지 않는 내가 한 신속 사용할 수 있습니다.

스위프트와의 Obj-C 프로젝트의 버전 :https://www.dropbox.com/sh/bsw8cinn7kp9kfe/AAAgG_B44dbHNP5-JwJ3Amf8a?dl=0

답변

0

이 프로젝트는 컴파일 때문에 브리지 헤더는 문제가되지 않을 수 있습니다.

연결 단계에서 실패하면 컴파일러에서 현재 아키텍처에 대한 심볼 집합을 찾을 수 없습니다. 이 중 하나를 할 수 코다 라이브러리 아키텍처

또는

2

) 모든 라이브러리를 찾을 수 없습니다 링커에 대한 컴파일되지 않음)

1을 의미한다.

Obj-C 프로젝트를 보았는데 프로젝트에 Coda 라이브러리가 없으므로 # 2를 추측합니다.lib를 프로젝트로 어떻게 든 옮기거나 프로젝트의 "라이브러리 검색 경로"에서 시스템의 다른 위치로 lib에 경로를 추가 할 것입니다