3

I'm trying to get familiar with Swift Package Manager. That's what I did:

    • swift package init --type executable
    • added a dependency in Package.swift
    • swift build

And everything was fine, but after I tried to import Dependency in the code xcode says: no such module.

My Package.swift looks like:

import PackageDescription

let package = Package(
    name: "todo-bot",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(url: "https://github.com/zmeyc/telegram-bot-swift.git", from: "0.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(
            named: "todo-bot",
            dependencies: ["telegram-bot-swift"]),
    ]
)

And when i try to build it without xcode it goes

  • Compile Swift Module 'SwiftyJSON' (2 sources)
    • Compile Swift Module 'ScannerUtils' (2 sources)
    • Compile Swift Module 'TelegramBot' (135 sources)
    • Compile Swift Module 'todo_bot' (1 sources)

/opt/local/include/curl/system.h:399:12: note: while building module 'Darwin' imported from /opt/local/include/curl/system.h:399: # include ^ :338:9: note: in file included from :338: #import "ncurses.h" ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/ncurses.h:141:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/ncurses.h:141: #include ^ /opt/local/include/unctrl.h:60:63: error: unknown type name 'SCREEN' NCURSES_EXPORT(NCURSES_CONST char ) NCURSES_SP_NAME(unctrl) (SCREEN, chtype); ^ /opt/local/include/curl/system.h:399:12: note: while building module 'Darwin' imported from /opt/local/include/curl/system.h:399: '#' include ^

2
  • Does this similar question help? Remember, google is your friend, and on this site, it's best if you can tell people what research you've already done on your own. What you found by googling should be prominent. Commented Mar 5, 2018 at 21:07
  • 1
    What dependency? How does your package definition looks like? Please update the question with these details (at least) Commented Mar 5, 2018 at 21:23

1 Answer 1

2

I have noticed this issue creep up on me today too. I followed the following steps to get rid of this error.

  1. Close Xcode application
  2. Delete the .xcodeproj file
  3. Regenerate the packages again by running swift package generate-xcodeproj.

The next time you open the Xcode project the packages will be installed correctly and you won't have any build issues. Not sure this is going to help someone but I hope it does :)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.