Error: use of unresolved identifier

New to Swift here

I'm trying to play with local imports

I have a project called glfw and I'm importing a local project glm, both under git and glm is also tagged (1.0.0)

glfw's Package.swift is the following:

let package = Package(
    name: "glfw",
    products: [
        .library(name: "glfw", targets: ["glfw"]),
    ],
    dependencies: [
        .package(url: "../glm", .revision("b7f9cfe44f18daa9b24296ea5841156211031539"))
    ],
    targets: [
        .target(name: "glfw", dependencies: ["glm"]),
        .testTarget(name: "glfwTests", dependencies: ["glfw", "glm"]),
    ]
)

I tried to modify glfw.swift by importing glm (resolved) and writing a simple
let a = vec2()
which is also resolved properly in CLion

But whenever I try to run glfwTests (it's a library, not an executable), then I get:

error: use of unresolved identifier 'vec2'

Why?

You need make vec2 public since it's in a different Swift module. Also, it might be better use a path-based dependency if you're working on these packages in tandem.

1 Like

Thanks Aciid, it was that!

Sorry for the dumb question :stuck_out_tongue:

Terms of Service

Privacy Policy

Cookie Policy