xuchunyang / osx-dictionary.el

Mac OS X Dictionary.app interface for Emacs
139 stars 23 forks source link

Fail to compile cli under macOS 14.4.1 #36

Closed cxa closed 7 months ago

cxa commented 7 months ago
clang -O3 -framework CoreServices -framework Foundation osx-dictionary.m -o osx-dictionary-cli

osx-dictionary.m:19:21: warning: receiver 'NSString' is a forward class and corresponding @interface may not exist [-Wreceiver-forward-class]
  NSString* word = [NSString stringWithUTF8String:searchword];
                    ^~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:260:8: note: forward declaration of class here
@class NSString;
       ^
osx-dictionary.m:19:30: warning: class method '+stringWithUTF8String:' not found (return type defaults to 'id') [-Wobjc-method-access]
  NSString* word = [NSString stringWithUTF8String:searchword];
                             ^~~~~~~~~~~~~~~~~~~~
osx-dictionary.m:21:64: warning: instance method '-length' not found (return type defaults to 'id') [-Wobjc-method-access]
                                          CFRangeMake(0, [word length]));
                                                               ^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:260:8: note: receiver is instance of class declared here
@class NSString;
       ^
osx-dictionary.m:21:58: error: incompatible pointer to integer conversion passing 'id' to parameter of type 'CFIndex' (aka 'long') [-Wint-conversion]
                                          CFRangeMake(0, [word length]));
                                                         ^~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:530:52: note: passing argument to parameter 'len' here
CF_INLINE CFRange CFRangeMake(CFIndex loc, CFIndex len) {
                                                   ^
osx-dictionary.m:83:28: warning: instance method '-UTF8String' not found (return type defaults to 'id') [-Wobjc-method-access]
  char* r = (char*)[result UTF8String];
                           ^~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:260:8: note: receiver is instance of class declared here
@class NSString;
       ^
4 warnings and 1 error generated.
cxa commented 7 months ago

Update:

After add #import <Foundation/Foundation.h> to osx-dictionary.m, compile successfully.

xuchunyang commented 7 months ago

Your fix works for me too. Could you submit a PR?

cxa commented 7 months ago

Sure.

xuchunyang commented 7 months ago

Thanks