无法使用包管理器在xcode中构建Swift项目

时间:2019-01-10 17:17:58

标签: swift xcode

我只是从swift和xcode开始。我遵循了PackageManager上的教程,然后使用“ swift包generate-xcodeproj”为xcode创建了一个项目

然后我添加了第一个依赖项

 dependencies: [
        .package(url: "https://github.com/ShawnMoore/XMLParsing.git", from: "0.0.3")
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "mame",
            dependencies: [
            "XMLParsing"
            ]),
        .testTarget(
            name: "mameTests",
            dependencies: ["mame"]),
    ]

使用命令行构建时,它可以工作,但是如果我从xcode运行main.swift,则会收到错误消息:

Undefined symbols for architecture x86_64:
  "XMLParsing.XMLDecoder.__allocating_init() -> XMLParsing.XMLDecoder", referenced from:
      _globalinit_33_99E47C2F510692DAC28588DE7EBED031_func2 in mame.o
  "type metadata accessor for XMLParsing.XMLDecoder", referenced from:
      _globalinit_33_99E47C2F510692DAC28588DE7EBED031_func2 in mame.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

由于我才刚刚开始,所以我不知道这意味着什么,为什么xcode无法看到该库?我已将构建导入搜索路径配置为包括导入包所在的./build/debug。我在这里还想念什么?

谢谢

0 个答案:

没有答案