SDWebImage / libwebp-Xcode

A wrapper for libwebp + Xcode project. Support Carthage && CocoaPods && SwiftPM.
56 stars 36 forks source link

Error while importing headers: 'webp/decode.h' file not found #9

Closed roblabs closed 3 years ago

roblabs commented 3 years ago

The Swift Package Manager is used to pull libwebp into an Objective-C project. When attempting to use import the headers, the search path doesn't appear to be used.

#import <webp/decode.h>


The error is

util/webp_reader.cpp:7:9: fatal error: 'webp/decode.h' file not found #import <webp/decode.h>

The project cannot use the preferred @import libwebp. Thank you for supporting Swift PM in this project, as it is very useful.

dreampiggy commented 3 years ago

Use

#import <libwebp/decode.h>
roblabs commented 3 years ago

None of the following worked, all gave the error in Xcode, Preprocessor error file not found

  1. #import <libwebp/decode.h>
  2. #import <libwebp/webp/decode.h>
  3. #import <webp/decode.h> // this the recommendation from the readme

The Package.swift implies that the 3rd option, readme documentation, makes the most sense:

sources: ["libwebp/src"],
publicHeadersPath: "include",

https://github.com/SDWebImage/libwebp-Xcode/blob/master/Package.swift#L24,L30

dreampiggy commented 3 years ago

Maybe we should use the @import libwebp. Or custom the Swift Include Path for this..