callstack / react-native-image-editor

A library providing an API for cropping images from the web and the local file system.
MIT License
383 stars 118 forks source link

call to undeclared function 'RCTTransformFromTargetRect'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] CGAffineTransform transform = RCTTransformFromTargetRect(image.size, targetRect); #120

Closed xha123 closed 8 months ago

xha123 commented 1 year ago

Environment

react-native:0.71.9 "@react-native-community/image-editor": "^2.3.0", xcode:14.3 ios:16.4

Description

/node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:65:35: error: call to undeclared function 'RCTTransformFromTargetRect'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] CGAffineTransform transform = RCTTransformFromTargetRect(image.size, targetRect); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:65:35: error: declaration of 'RCTTransformFromTargetRect' must be imported from module 'React.RCTImageUtils' before it is required In module 'React' imported from /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.h:8: /ios/Pods/Headers/Public/React-Core/React/RCTImageUtils.h:28:30: note: declaration here is not visible RCT_EXTERN CGAffineTransform RCTTransformFromTargetRect(CGSize sourceSize, CGRect targetRect); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:65:35: warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype] CGAffineTransform transform = RCTTransformFromTargetRect(image.size, targetRect); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:65:35: error: conflicting types for 'RCTTransformFromTargetRect' In module 'React' imported from /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.h:8: /ios/Pods/Headers/Public/React-Core/React/RCTImageUtils.h:28:30: note: previous declaration is here RCT_EXTERN CGAffineTransform RCTTransformFromTargetRect(CGSize sourceSize, CGRect targetRect); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:66:29: error: call to undeclared function 'RCTTransformImage'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] UIImage croppedImage = RCTTransformImage(image, targetSize, image.scale, transform); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:66:29: error: declaration of 'RCTTransformImage' must be imported from module 'React.RCTImageUtils' before it is required In module 'React' imported from /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.h:8: /ios/Pods/Headers/Public/React-Core/React/RCTImageUtils.h:87:1: note: declaration here is not visible RCTTransformImage(UIImage image, CGSize destSize, CGFloat destScale, CGAffineTransform transform); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:66:29: warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype] UIImage croppedImage = RCTTransformImage(image, targetSize, image.scale, transform); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:66:29: error: conflicting types for 'RCTTransformImage' In module 'React' imported from /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.h:8: /ios/Pods/Headers/Public/React-Core/React/RCTImageUtils.h:87:1: note: previous declaration is here RCTTransformImage(UIImage image, CGSize destSize, CGFloat destScale, CGAffineTransform transform); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:72:20: error: call to undeclared function 'RCTTargetRect'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] targetRect = RCTTargetRect(croppedImage.size, targetSize, 1, resizeMode); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:72:20: error: declaration of 'RCTTargetRect' must be imported from module 'React.RCTImageUtils' before it is required In module 'React' imported from /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.h:8: /ios/Pods/Headers/Public/React-Core/React/RCTImageUtils.h:21:19: note: declaration here is not visible RCT_EXTERN CGRect RCTTargetRect(CGSize sourceSize, CGSize destSize, CGFloat destScale, RCTResizeMode resizeMode); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:72:20: warning: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype] targetRect = RCTTargetRect(croppedImage.size, targetSize, 1, resizeMode); ^ /node_modules/@react-native-community/image-editor/ios/RNCImageEditor.m:72:20: error: conflicting types for 'RCTTargetRect'

retyui commented 8 months ago

You need to add this to your compiler flags (e. g. in the xcconfig file or under User-Defined in the build settings):

WARNING_CFLAGS = -Wno-declaration-after-statement

Screenshot 2024-03-10 at 13 23 04